lib/google/cloud/translate.rb in google-cloud-translate-1.3.0 vs lib/google/cloud/translate.rb in google-cloud-translate-1.3.1
- old
+ new
@@ -37,12 +37,10 @@
# reassemble the translated content.
#
# See {file:OVERVIEW.md Translation Overview}.
#
module Translate
- # rubocop:disable Metrics/AbcSize
-
##
# Creates a new object for connecting to Cloud Translation API. Each call
# creates a new connection.
#
# Like other Cloud Platform services, Google Cloud Translation API
@@ -127,23 +125,19 @@
unless credentials.is_a? Google::Auth::Credentials
credentials = Translate::Credentials.new credentials, scope: scope
end
- if credentials.respond_to? :project_id
- project_id ||= credentials.project_id
- end
+ project_id ||= credentials.project_id if credentials.respond_to? :project_id
project_id = project_id.to_s # Always cast to a string
raise ArgumentError, "project_id is missing" if project_id.empty?
Translate::Api.new(
Translate::Service.new(
project_id, credentials, retries: retries, timeout: timeout
)
)
end
-
- # rubocop:enable Metrics/AbcSize
##
# Configure the Google Cloud Translate library.
#
# The following Translate configuration parameters are supported: