Module: Gcloud
- Defined in:
- lib/gcloud.rb,
lib/gcloud/dns.rb,
lib/gcloud/gce.rb,
lib/gcloud/errors.rb,
lib/gcloud/pubsub.rb,
lib/gcloud/vision.rb,
lib/gcloud/backoff.rb,
lib/gcloud/logging.rb,
lib/gcloud/storage.rb,
lib/gcloud/version.rb,
lib/gcloud/bigquery.rb,
lib/gcloud/dns/zone.rb,
lib/gcloud/datastore.rb,
lib/gcloud/translate.rb,
lib/gcloud/dns/change.rb,
lib/gcloud/dns/record.rb,
lib/gcloud/grpc_utils.rb,
lib/gcloud/credentials.rb,
lib/gcloud/dns/project.rb,
lib/gcloud/dns/service.rb,
lib/gcloud/bigquery/job.rb,
lib/gcloud/dns/importer.rb,
lib/gcloud/logging/sink.rb,
lib/gcloud/pubsub/topic.rb,
lib/gcloud/storage/file.rb,
lib/gcloud/vision/image.rb,
lib/gcloud/bigquery/data.rb,
lib/gcloud/bigquery/view.rb,
lib/gcloud/datastore/key.rb,
lib/gcloud/dns/zone/list.rb,
lib/gcloud/logging/entry.rb,
lib/gcloud/pubsub/policy.rb,
lib/gcloud/translate/api.rb,
lib/gcloud/bigquery/table.rb,
lib/gcloud/logging/logger.rb,
lib/gcloud/logging/metric.rb,
lib/gcloud/pubsub/message.rb,
lib/gcloud/pubsub/project.rb,
lib/gcloud/pubsub/service.rb,
lib/gcloud/storage/bucket.rb,
lib/gcloud/storage/errors.rb,
lib/gcloud/vision/project.rb,
lib/gcloud/vision/service.rb,
lib/gcloud/bigquery/schema.rb,
lib/gcloud/datastore/query.rb,
lib/gcloud/dns/change/list.rb,
lib/gcloud/dns/credentials.rb,
lib/gcloud/dns/record/list.rb,
lib/gcloud/logging/project.rb,
lib/gcloud/logging/service.rb,
lib/gcloud/storage/project.rb,
lib/gcloud/storage/service.rb,
lib/gcloud/vision/annotate.rb,
lib/gcloud/vision/location.rb,
lib/gcloud/bigquery/dataset.rb,
lib/gcloud/bigquery/project.rb,
lib/gcloud/bigquery/service.rb,
lib/gcloud/datastore/commit.rb,
lib/gcloud/datastore/cursor.rb,
lib/gcloud/datastore/entity.rb,
lib/gcloud/datastore/errors.rb,
lib/gcloud/logging/resource.rb,
lib/gcloud/resource_manager.rb,
lib/gcloud/storage/file/acl.rb,
lib/gcloud/bigquery/copy_job.rb,
lib/gcloud/bigquery/job/list.rb,
lib/gcloud/bigquery/load_job.rb,
lib/gcloud/datastore/dataset.rb,
lib/gcloud/datastore/service.rb,
lib/gcloud/logging/sink/list.rb,
lib/gcloud/pubsub/topic/list.rb,
lib/gcloud/storage/file/list.rb,
lib/gcloud/translate/service.rb,
lib/gcloud/vision/annotation.rb,
lib/gcloud/bigquery/query_job.rb,
lib/gcloud/logging/entry/list.rb,
lib/gcloud/pubsub/credentials.rb,
lib/gcloud/storage/bucket/acl.rb,
lib/gcloud/translate/language.rb,
lib/gcloud/vision/credentials.rb,
lib/gcloud/bigquery/query_data.rb,
lib/gcloud/bigquery/table/list.rb,
lib/gcloud/datastore/gql_query.rb,
lib/gcloud/logging/credentials.rb,
lib/gcloud/logging/metric/list.rb,
lib/gcloud/pubsub/subscription.rb,
lib/gcloud/storage/bucket/cors.rb,
lib/gcloud/storage/bucket/list.rb,
lib/gcloud/storage/credentials.rb,
lib/gcloud/translate/detection.rb,
lib/gcloud/bigquery/credentials.rb,
lib/gcloud/bigquery/extract_job.rb,
lib/gcloud/datastore/grpc_utils.rb,
lib/gcloud/datastore/properties.rb,
lib/gcloud/dns/zone/transaction.rb,
lib/gcloud/bigquery/dataset/list.rb,
lib/gcloud/datastore/credentials.rb,
lib/gcloud/datastore/transaction.rb,
lib/gcloud/storage/file/verifier.rb,
lib/gcloud/translate/translation.rb,
lib/gcloud/pubsub/topic/publisher.rb,
lib/gcloud/vision/annotation/face.rb,
lib/gcloud/vision/annotation/text.rb,
lib/gcloud/bigquery/dataset/access.rb,
lib/gcloud/logging/entry/operation.rb,
lib/gcloud/pubsub/received_message.rb,
lib/gcloud/resource_manager/policy.rb,
lib/gcloud/bigquery/insert_response.rb,
lib/gcloud/pubsub/subscription/list.rb,
lib/gcloud/resource_manager/manager.rb,
lib/gcloud/resource_manager/project.rb,
lib/gcloud/resource_manager/service.rb,
lib/gcloud/vision/annotation/entity.rb,
lib/gcloud/vision/annotation/vertex.rb,
lib/gcloud/logging/entry/http_request.rb,
lib/gcloud/logging/resource_descriptor.rb,
lib/gcloud/resource_manager/credentials.rb,
lib/gcloud/vision/annotation/properties.rb,
lib/gcloud/resource_manager/project/list.rb,
lib/gcloud/vision/annotation/safe_search.rb,
lib/gcloud/datastore/dataset/query_results.rb,
lib/gcloud/datastore/dataset/lookup_results.rb,
lib/gcloud/logging/resource_descriptor/list.rb,
lib/gcloud/resource_manager/project/updater.rb
Overview
# Google Cloud
The gcloud-ruby library is the official library for interacting with Google Cloud Platform. Google Cloud Platform is a set of modular cloud-based services that allow you to create anything from simple websites to complex applications.
The goal of gcloud-ruby is to provide a API that is familiar and comfortable to Rubyists. Authentication is handled by providing project and credential information, or if you are running on Google Compute Engine this configuration is taken care of for you.
You can learn more about various options for connection on the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
Defined Under Namespace
Modules: Bigquery, Datastore, Dns, GCE, GRPCUtils, Logging, Pubsub, ResourceManager, Storage, Translate, Vision Classes: AbortedError, AlreadyExistsError, Backoff, CanceledError, Credentials, DataLossError, DeadlineExceededError, Error, FailedPreconditionError, InternalError, InvalidArgumentError, NotFoundError, OutOfRangeError, PermissionDeniedError, ResourceExhaustedError, UnauthenticatedError, UnavailableError, UnimplementedError, UnknownError
Constant Summary collapse
- VERSION =
"0.12.1"
Class Method Summary collapse
-
.bigquery(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Bigquery::Project
Creates a new ‘Project` instance connected to the BigQuery service.
-
.datastore(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Datastore::Dataset
Creates a new object for connecting to the Datastore service.
-
.dns(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Dns::Project
Creates a new ‘Project` instance connected to the DNS service.
-
.logging(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Logging::Project
Creates a new object for connecting to the Stackdriver Logging service.
-
.new(project = nil, keyfile = nil, retries: nil, timeout: nil) ⇒ Gcloud
Creates a new object for connecting to Google Cloud.
-
.pubsub(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service.
-
.resource_manager(keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::ResourceManager::Manager
Creates a new ‘Project` instance connected to the Resource Manager service.
-
.storage(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Storage::Project
Creates a new object for connecting to the Storage service.
-
.translate(key = nil, retries: nil, timeout: nil) ⇒ Gcloud::Translate::Api
Creates a new object for connecting to the Translate service.
-
.vision(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Vision::Project
Creates a new object for connecting to the Vision service.
Instance Method Summary collapse
-
#bigquery(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Bigquery::Project
Creates a new object for connecting to the BigQuery service.
-
#datastore(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Datastore::Dataset
Creates a new object for connecting to the Datastore service.
-
#dns(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Dns::Project
Creates a new object for connecting to the DNS service.
-
#logging(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Logging::Project
Creates a new object for connecting to the Stackdriver Logging service.
-
#pubsub(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service.
-
#resource_manager(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::ResourceManager::Manager
Creates a new object for connecting to the Resource Manager service.
-
#storage(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Storage::Project
Creates a new object for connecting to the Storage service.
-
#translate(key = nil, retries: nil, timeout: nil) ⇒ Gcloud::Translate::Api
Creates a new object for connecting to the Translate service.
-
#vision(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Vision::Project
Creates a new object for connecting to the Vision service.
Class Method Details
.bigquery(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Bigquery::Project
Creates a new ‘Project` instance connected to the BigQuery service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gcloud/bigquery.rb', line 52 def self.bigquery project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Bigquery::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Gcloud::Bigquery::Credentials.default scope: scope else credentials = Gcloud::Bigquery::Credentials.new keyfile, scope: scope end Gcloud::Bigquery::Project.new( Gcloud::Bigquery::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
.datastore(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Datastore::Dataset
Creates a new object for connecting to the Datastore service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/gcloud/datastore.rb', line 63 def self.datastore project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Datastore::Dataset.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if ENV["DATASTORE_EMULATOR_HOST"] return Gcloud::Datastore::Dataset.new( Gcloud::Datastore::Service.new( project, :this_channel_is_insecure, host: ENV["DATASTORE_EMULATOR_HOST"], retries: retries)) end if keyfile.nil? credentials = Gcloud::Datastore::Credentials.default scope: scope else credentials = Gcloud::Datastore::Credentials.new keyfile, scope: scope end Gcloud::Datastore::Dataset.new( Gcloud::Datastore::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
.dns(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Dns::Project
Creates a new ‘Project` instance connected to the DNS service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/gcloud/dns.rb', line 53 def self.dns project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Dns::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Gcloud::Dns::Credentials.default scope: scope else credentials = Gcloud::Dns::Credentials.new keyfile, scope: scope end Gcloud::Dns::Project.new( Gcloud::Dns::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
.logging(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Logging::Project
Creates a new object for connecting to the Stackdriver Logging service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gcloud/logging.rb', line 52 def self.logging project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Logging::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Gcloud::Logging::Credentials.default scope: scope else credentials = Gcloud::Logging::Credentials.new keyfile, scope: scope end Gcloud::Logging::Project.new( Gcloud::Logging::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
.new(project = nil, keyfile = nil, retries: nil, timeout: nil) ⇒ Gcloud
Creates a new object for connecting to Google Cloud.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
59 60 61 62 63 64 65 66 67 |
# File 'lib/gcloud.rb', line 59 def self.new project = nil, keyfile = nil, retries: nil, timeout: nil gcloud = Object.new gcloud.instance_variable_set "@project", project gcloud.instance_variable_set "@keyfile", keyfile gcloud.instance_variable_set "@retries", retries gcloud.instance_variable_set "@timeout", timeout gcloud.extend Gcloud gcloud end |
.pubsub(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gcloud/pubsub.rb', line 53 def self.pubsub project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Pubsub::Project.default_project if ENV["PUBSUB_EMULATOR_HOST"] ps = Gcloud::Pubsub::Project.new project, :this_channel_is_insecure ps.service.host = ENV["PUBSUB_EMULATOR_HOST"] return ps end if keyfile.nil? credentials = Gcloud::Pubsub::Credentials.default scope: scope else credentials = Gcloud::Pubsub::Credentials.new keyfile, scope: scope end Gcloud::Pubsub::Project.new( Gcloud::Pubsub::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
.resource_manager(keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::ResourceManager::Manager
Creates a new ‘Project` instance connected to the Resource Manager service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gcloud/resource_manager.rb', line 51 def self.resource_manager keyfile = nil, scope: nil, retries: nil, timeout: nil if keyfile.nil? credentials = Gcloud::ResourceManager::Credentials.default scope: scope else credentials = Gcloud::ResourceManager::Credentials.new keyfile, scope: scope end Gcloud::ResourceManager::Manager.new( Gcloud::ResourceManager::Service.new( credentials, retries: retries, timeout: timeout)) end |
.storage(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Storage::Project
Creates a new object for connecting to the Storage service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/gcloud/storage.rb', line 54 def self.storage project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Storage::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Gcloud::Storage::Credentials.default scope: scope else credentials = Gcloud::Storage::Credentials.new keyfile, scope: scope end Gcloud::Storage::Project.new( Gcloud::Storage::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
.translate(key = nil, retries: nil, timeout: nil) ⇒ Gcloud::Translate::Api
Creates a new object for connecting to the Translate service. Each call creates a new connection.
Unlike other Cloud Platform services, which authenticate using a project ID and OAuth 2.0 credentials, Google Translate API requires a public API access key. (This may change in future releases of Google Translate API.) Follow the general instructions at [Identifying your application to Google](cloud.google.com/translate/v2/using_rest#auth), and the specific instructions for [Server keys](cloud.google.com/translate/v2/using_rest#creating-server-api-keys).
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gcloud/translate.rb', line 57 def self.translate key = nil, retries: nil, timeout: nil key ||= ENV["TRANSLATE_KEY"] if key.nil? key_missing_msg = "An API key is required to use the Translate API." fail ArgumentError, key_missing_msg end Gcloud::Translate::Api.new( Gcloud::Translate::Service.new( key, retries: retries, timeout: timeout)) end |
.vision(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Vision::Project
Creates a new object for connecting to the Vision service. Each call creates a new connection.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/gcloud/vision.rb', line 53 def self.vision project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil project ||= Gcloud::Vision::Project.default_project project = project.to_s # Always cast to a string fail ArgumentError, "project is missing" if project.empty? if keyfile.nil? credentials = Gcloud::Vision::Credentials.default scope: scope else credentials = Gcloud::Vision::Credentials.new keyfile, scope: scope end Gcloud::Vision::Project.new( Gcloud::Vision::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
Instance Method Details
#bigquery(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Bigquery::Project
Creates a new object for connecting to the BigQuery service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
247 248 249 250 251 252 |
# File 'lib/gcloud.rb', line 247 def bigquery scope: nil, retries: nil, timeout: nil require "gcloud/bigquery" Gcloud.bigquery @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#datastore(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Datastore::Dataset
Creates a new object for connecting to the Datastore service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
112 113 114 115 116 117 |
# File 'lib/gcloud.rb', line 112 def datastore scope: nil, retries: nil, timeout: nil require "gcloud/datastore" Gcloud.datastore @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#dns(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Dns::Project
Creates a new object for connecting to the DNS service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
292 293 294 295 296 297 |
# File 'lib/gcloud.rb', line 292 def dns scope: nil, retries: nil, timeout: nil require "gcloud/dns" Gcloud.dns @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#logging(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Logging::Project
Creates a new object for connecting to the Stackdriver Logging service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
384 385 386 387 388 389 |
# File 'lib/gcloud.rb', line 384 def logging scope: nil, retries: nil, timeout: nil require "gcloud/logging" Gcloud.logging @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#pubsub(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
201 202 203 204 205 206 |
# File 'lib/gcloud.rb', line 201 def pubsub scope: nil, retries: nil, timeout: nil require "gcloud/pubsub" Gcloud.pubsub @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#resource_manager(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::ResourceManager::Manager
Creates a new object for connecting to the Resource Manager service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
340 341 342 343 344 345 |
# File 'lib/gcloud.rb', line 340 def resource_manager scope: nil, retries: nil, timeout: nil require "gcloud/resource_manager" Gcloud.resource_manager @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#storage(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Storage::Project
Creates a new object for connecting to the Storage service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
158 159 160 161 162 163 |
# File 'lib/gcloud.rb', line 158 def storage scope: nil, retries: nil, timeout: nil require "gcloud/storage" Gcloud.storage @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#translate(key = nil, retries: nil, timeout: nil) ⇒ Gcloud::Translate::Api
Creates a new object for connecting to the Translate service. Each call creates a new connection.
Unlike other Cloud Platform services, which authenticate using a project ID and OAuth 2.0 credentials, Google Translate API requires a public API access key. (This may change in future releases of Google Translate API.) Follow the general instructions at [Identifying your application to Google](cloud.google.com/translate/v2/using_rest#auth), and the specific instructions for [Server keys](cloud.google.com/translate/v2/using_rest#creating-server-api-keys).
430 431 432 433 434 |
# File 'lib/gcloud.rb', line 430 def translate key = nil, retries: nil, timeout: nil require "gcloud/translate" Gcloud.translate key, retries: (retries || @retries), timeout: (timeout || @timeout) end |
#vision(scope: nil, retries: nil, timeout: nil) ⇒ Gcloud::Vision::Project
Creates a new object for connecting to the Vision service. Each call creates a new connection.
472 473 474 475 476 477 |
# File 'lib/gcloud.rb', line 472 def vision scope: nil, retries: nil, timeout: nil require "gcloud/vision" Gcloud.vision @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |