Module: Google::Cloud
- Defined in:
- lib/google/cloud.rb,
lib/google/cloud/config.rb,
lib/google/cloud/errors.rb,
lib/google/cloud/credentials.rb,
lib/google/cloud/core/version.rb
Defined Under Namespace
Modules: Core Classes: AbortedError, AlreadyExistsError, CanceledError, Config, DataLossError, DeadlineExceededError, Error, FailedPreconditionError, InternalError, InvalidArgumentError, NotFoundError, OutOfRangeError, PermissionDeniedError, ResourceExhaustedError, UnauthenticatedError, UnavailableError, UnimplementedError, UnknownError
Class Method Summary collapse
-
.configure {|@config| ... } ⇒ Google::Cloud::Config
Configure the default parameter for Google::Cloud.
-
.new(project_id = nil, credentials = nil, retries: nil, timeout: nil) ⇒ Google::Cloud
Creates a new object for connecting to Google Cloud.
Class Method Details
.configure {|@config| ... } ⇒ Google::Cloud::Config
Configure the default parameter for Google::Cloud. The values defined on this top level will be shared across all Google::Cloud libraries, which may also add fields to this object or add sub configuration options under this object.
Possible configuration parameters:
project_id
: The Google Cloud Project ID. Automatically discovered when running from GCP environments.credentials
: The service account JSON file path. Automatically discovered when running from GCP environments.
92 93 94 95 96 97 98 |
# File 'lib/google/cloud.rb', line 92 def self.configure @config ||= Config.create yield @config if block_given? @config end |
.new(project_id = nil, credentials = nil, retries: nil, timeout: nil) ⇒ Google::Cloud
Creates a new object for connecting to Google Cloud.
For more information on connecting to Google Cloud see the Authentication Guide.
66 67 68 69 70 71 72 73 74 |
# File 'lib/google/cloud.rb', line 66 def self.new project_id = nil, credentials = nil, retries: nil, timeout: nil gcloud = Object.new gcloud.instance_variable_set :@project, project_id gcloud.instance_variable_set :@keyfile, credentials gcloud.instance_variable_set :@retries, retries gcloud.instance_variable_set :@timeout, timeout gcloud.extend Google::Cloud gcloud end |