Module: Google::Cloud
- Defined in:
- lib/google-cloud-translate.rb,
lib/google/cloud/translate.rb,
lib/google/cloud/translate/api.rb,
lib/google/cloud/translate/service.rb,
lib/google/cloud/translate/version.rb,
lib/google/cloud/translate/language.rb,
lib/google/cloud/translate/detection.rb,
lib/google/cloud/translate/credentials.rb,
lib/google/cloud/translate/translation.rb
Defined Under Namespace
Modules: Translate
Class Method Summary collapse
-
.translate(key = nil, project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Translate::Api
Creates a new object for connecting to the Cloud Translation API.
Instance Method Summary collapse
-
#translate(key = nil, scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Translate::Api
Creates a new object for connecting to the Cloud Translation API.
Class Method Details
.translate(key = nil, project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Translate::Api
Creates a new object for connecting to the Cloud Translation API. Each call creates a new connection.
Like other Cloud Platform services, Google Cloud Translation API supports authentication using a project ID and OAuth 2.0 credentials. In addition, it supports authentication using a public API access key. (If both the API key and the project and OAuth 2.0 credentials are provided, the API key will be used.) Instructions and configuration options are covered in the Authentication Guide.
134 135 136 137 138 139 140 141 142 |
# File 'lib/google-cloud-translate.rb', line 134 def self.translate key = nil, project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, project: nil, keyfile: nil require "google/cloud/translate" Google::Cloud::Translate.new key: key, project_id: project_id, credentials: credentials, scope: scope, retries: retries, timeout: timeout, project: project, keyfile: keyfile end |
Instance Method Details
#translate(key = nil, scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Translate::Api
Creates a new object for connecting to the Cloud Translation API. Each call creates a new connection.
Like other Cloud Platform services, Google Cloud Translation API supports authentication using a project ID and OAuth 2.0 credentials. In addition, it supports authentication using a public API access key. (If both the API key and the project and OAuth 2.0 credentials are provided, the API key will be used.) Instructions and configuration options are covered in the Authentication Guide.
74 75 76 77 78 79 |
# File 'lib/google-cloud-translate.rb', line 74 def translate key = nil, scope: nil, retries: nil, timeout: nil Google::Cloud.translate key, project_id: @project, credentials: @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |