Method: Google::Cloud#spanner

Defined in:
lib/google-cloud-spanner.rb

#spanner(scope: nil, timeout: nil, client_config: nil) ⇒ Google::Cloud::Spanner::Project

Creates a new object for connecting to the Spanner service. Each call creates a new connection.

For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).

Examples:

require "google/cloud"

gcloud = Google::Cloud.new
spanner = gcloud.spanner

The default scope can be overridden with the scope option:

require "google/cloud"

gcloud  = Google::Cloud.new
platform_scope = "https://www.googleapis.com/auth/cloud-platform"
spanner = gcloud.spanner scope: platform_scope

Parameters:

  • scope (String, Array<String>) (defaults to: nil)

    The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. See [Using OAuth 2.0 to Access Google APIs](developers.google.com/identity/protocols/OAuth2).

    The default scopes are:

    • https://www.googleapis.com/auth/spanner

    • https://www.googleapis.com/auth/spanner.data

  • timeout (Integer) (defaults to: nil)

    Default timeout to use in requests. Optional.

  • client_config (Hash) (defaults to: nil)

    A hash of values to override the default behavior of the API client. Optional.

Returns:



61
62
63
64
65
# File 'lib/google-cloud-spanner.rb', line 61

def spanner scope: nil, timeout: nil, client_config: nil
  Google::Cloud.spanner @project, @keyfile, scope: scope,
                                            timeout: (timeout || @timeout),
                                            client_config: client_config
end