Reference documentation and code samples for the google-cloud-core module Google::Cloud.
Methods
.configure
defself.configure()->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.
on_error: A Proc to be run when an error is encountered during on a
background thread. The Proc must take the error object as
the single argument.
Yields
(@config)
Returns
(Google::Cloud::Config) — The top-level configuration object for
Google::Cloud libraries.
Creates a new object for connecting to Google Cloud.
For more information on connecting to Google Cloud see the
Authentication Guide.
Parameters
project_id (String) — Project identifier for the service you are
connecting to.
credentials (String, Hash, Google::Auth::Credentials) — The path to
the keyfile as a String, the contents of the keyfile as a Hash, or a
Google::Auth::Credentials object.
retries (Integer) (defaults to: nil) — Number of times to retry requests on server
error. The default value is 3. Optional.
timeout (Integer) (defaults to: nil) — Default timeout to use in requests. Optional.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# google-cloud-core - Module Google::Cloud (v1.8.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.8.0 (latest)](/ruby/docs/reference/google-cloud-core/latest/Google-Cloud)\n- [1.7.1](/ruby/docs/reference/google-cloud-core/1.7.1/Google-Cloud)\n- [1.6.1](/ruby/docs/reference/google-cloud-core/1.6.1/Google-Cloud) \nReference documentation and code samples for the google-cloud-core module Google::Cloud.\n\nMethods\n-------\n\n### .configure\n\n def self.configure() -\u003e Google::Cloud::Config\n\nConfigure the default parameter for Google::Cloud. The values defined on\nthis top level will be shared across all Google::Cloud libraries, which\nmay also add fields to this object or add sub configuration options under\nthis object.\n\nPossible configuration parameters:\n\n- `project_id`: The Google Cloud Project ID. Automatically discovered when running from GCP environments.\n- `credentials`: The service account JSON file path. Automatically discovered when running from GCP environments.\n- `on_error`: A Proc to be run when an error is encountered during on a background thread. The Proc must take the error object as the single argument. \n**Yields**\n\n- (@config) \n**Returns**\n\n- ([Google::Cloud::Config](./Google-Cloud-Config)) --- The top-level configuration object for Google::Cloud libraries.\n\n### .new\n\n def self.new(project_id = nil, credentials = nil, retries: nil, timeout: nil) -\u003e Google::Cloud\n\nCreates a new object for connecting to Google Cloud.\n\n\n\u003cbr /\u003e\n\nFor more information on connecting to Google Cloud see the\n[Authentication Guide](./AUTHENTICATION \"Authentication Guide\"). \n**Parameters**\n\n- **project_id** (String) --- Project identifier for the service you are connecting to.\n- **credentials** (String, Hash, Google::Auth::Credentials) --- The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.\n- **retries** (Integer) *(defaults to: nil)* --- Number of times to retry requests on server error. The default value is `3`. Optional.\n- **timeout** (Integer) *(defaults to: nil)* --- Default timeout to use in requests. Optional. \n**Returns**\n\n- ([Google::Cloud](./Google-Cloud))\n**Example** \n\n```ruby\nrequire \"google/cloud\"\n\ngcloud = Google::Cloud.new\ndatastore = gcloud.datastore\npubsub = gcloud.pubsub\nstorage = gcloud.storage\n```"]]