lib/google-cloud-language.rb in google-cloud-language-0.20.2 vs lib/google-cloud-language.rb in google-cloud-language-0.21.0
- old
+ new
@@ -36,12 +36,13 @@
# APIs](https://developers.google.com/identity/protocols/OAuth2).
#
# The default scope is:
#
# * `"https://www.googleapis.com/auth/cloud-platform"`
- # @param [Integer] retries This option is not currently supported.
# @param [Integer] timeout Default timeout to use in requests. Optional.
+ # @param [Hash] client_config A hash of values to override the default
+ # behavior of the API client. Optional.
#
# @return [Google::Cloud::Language::Project]
#
# @example
# require "google/cloud"
@@ -58,14 +59,14 @@
#
# gcloud = Google::Cloud.new
# platform_scope = "https://www.googleapis.com/auth/cloud-platform"
# language = gcloud.language scope: platform_scope
#
- def language scope: nil, retries: nil, timeout: nil
- Google::Cloud.language @project, @keyfile, scope: scope,
- retries: (retries || @retries),
- timeout: (timeout || @timeout)
+ def language scope: nil, timeout: nil, client_config: nil
+ Google::Cloud.language @project, @keyfile,
+ scope: scope, timeout: (timeout || @timeout),
+ client_config: client_config
end
##
# Creates a new object for connecting to the Language service.
# Each call creates a new connection.
@@ -83,35 +84,29 @@
# APIs](https://developers.google.com/identity/protocols/OAuth2).
#
# The default scope is:
#
# * `"https://www.googleapis.com/auth/cloud-platform"`
- # @param [Integer] retries This option is not currently supported.
# @param [Integer] timeout Default timeout to use in requests. Optional.
+ # @param [Hash] client_config A hash of values to override the default
+ # behavior of the API client. Optional.
#
# @return [Google::Cloud::Language::Project]
#
# @example
- # require "google/cloud/language"
+ # require "google/cloud"
#
# language = Google::Cloud.language
#
# content = "Darth Vader is the best villain in Star Wars."
# document = language.document content
# annotation = document.annotate
#
- def self.language project = nil, keyfile = nil, scope: nil, retries: nil,
- timeout: nil
+ def self.language project = nil, keyfile = nil, scope: nil, timeout: nil,
+ client_config: nil
require "google/cloud/language"
- project ||= Google::Cloud::Language::Project.default_project
- if keyfile.nil?
- credentials = Google::Cloud::Language::Credentials.default scope: scope
- else
- credentials = Google::Cloud::Language::Credentials.new(
- keyfile, scope: scope)
- end
- Google::Cloud::Language::Project.new(
- Google::Cloud::Language::Service.new(
- project, credentials, retries: retries, timeout: timeout))
+ Google::Cloud::Language.new project: project, keyfile: keyfile,
+ scope: scope, timeout: timeout,
+ client_config: client_config
end
end
end