module Google::Cloud

Public Class Methods

firestore(project_id = nil, credentials = nil, scope: nil, timeout: nil) click to toggle source

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

For more information on connecting to Google Cloud see the {file:AUTHENTICATION.md Authentication Guide}.

@param [String] project_id Identifier for a Firestore project. If not

present, the default project for the credentials is used.

@param [String, Hash, Google::Auth::Credentials] credentials The path to

the keyfile as a String, the contents of the keyfile as a Hash, or a
Google::Auth::Credentials object. (See {Firestore::Credentials})

@param [String, Array<String>] scope 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](https://developers.google.com/identity/protocols/OAuth2).

The default scope is:

* `https://www.googleapis.com/auth/datastore`

@param [Integer] timeout Default timeout to use in requests. Optional.

@return [Google::Cloud::Firestore::Client]

@example

require "google/cloud"

firestore = Google::Cloud.firestore
# File lib/google-cloud-firestore.rb, line 94
def self.firestore project_id = nil, credentials = nil, scope: nil, timeout: nil
  require "google/cloud/firestore"
  Google::Cloud::Firestore.new project_id:  project_id,
                               credentials: credentials,
                               scope:       scope,
                               timeout:     timeout
end

Public Instance Methods

firestore(scope: nil, timeout: nil) click to toggle source

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

For more information on connecting to Google Cloud see the {file:AUTHENTICATION.md Authentication Guide}.

@param [String, Array<String>] scope 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](https://developers.google.com/identity/protocols/OAuth2).

The default scope is:

* `https://www.googleapis.com/auth/datastore`

@param [Integer] timeout Default timeout to use in requests. Optional.

@return [Google::Cloud::Firestore::Client]

@example

require "google/cloud"

gcloud = Google::Cloud.new
firestore = gcloud.firestore

@example 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"
firestore = gcloud.firestore scope: platform_scope
# File lib/google-cloud-firestore.rb, line 61
def firestore scope: nil, timeout: nil
  Google::Cloud.firestore @project, @keyfile, scope: scope, timeout: (timeout || @timeout)
end