# google-cloud-core - Module Google::Cloud (v1.8.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.8.0 (latest)](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-core/latest/Google-Cloud)
- [1.7.1](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-core/1.7.1/Google-Cloud)
- [1.6.1](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-core/1.6.1/Google-Cloud)
Reference documentation and code samples for the google-cloud-core module Google::Cloud.

## Methods

### .configure

    def self.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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-core/latest/Google-Cloud-Config)) --- The top-level configuration object for Google::Cloud libraries.

### .new

    def self.new(project_id = nil, credentials = nil, retries: nil, timeout: nil) -> Google::Cloud

Creates a new object for connecting to Google Cloud.


<br />

For more information on connecting to Google Cloud see the
[Authentication Guide](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-core/latest/AUTHENTICATION "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.
**Returns**

- ([Google::Cloud](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-core/latest/Google-Cloud))
**Example**

```ruby
require "google/cloud"

gcloud  = Google::Cloud.new
datastore = gcloud.datastore
pubsub  = gcloud.pubsub
storage = gcloud.storage
```