Module: Google::Cloud

Defined in:
lib/google-cloud-firestore.rb,
lib/google/cloud/firestore.rb,
lib/google/cloud/firestore/batch.rb,
lib/google/cloud/firestore/query.rb,
lib/google/cloud/firestore/client.rb,
lib/google/cloud/firestore/convert.rb,
lib/google/cloud/firestore/service.rb,
lib/google/cloud/firestore/version.rb,
lib/google/cloud/firestore/generate.rb,
lib/google/cloud/firestore/field_path.rb,
lib/google/cloud/firestore/credentials.rb,
lib/google/cloud/firestore/field_value.rb,
lib/google/cloud/firestore/transaction.rb,
lib/google/cloud/firestore/watch/order.rb,
lib/google/cloud/firestore/resource_path.rb,
lib/google/cloud/firestore/query_listener.rb,
lib/google/cloud/firestore/query_snapshot.rb,
lib/google/cloud/firestore/watch/listener.rb,
lib/google/cloud/firestore/commit_response.rb,
lib/google/cloud/firestore/document_change.rb,
lib/google/cloud/firestore/query_partition.rb,
lib/google/cloud/firestore/watch/inventory.rb,
lib/google/cloud/firestore/collection_group.rb,
lib/google/cloud/firestore/document_listener.rb,
lib/google/cloud/firestore/document_snapshot.rb,
lib/google/cloud/firestore/document_reference.rb,
lib/google/cloud/firestore/collection_reference.rb,
lib/google/cloud/firestore/watch/enumerator_queue.rb,
lib/google/cloud/firestore/document_reference/list.rb,
lib/google/cloud/firestore/collection_reference_list.rb

Defined Under Namespace

Modules: Firestore

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.firestore(project_id = nil, credentials = nil, scope: nil, timeout: nil) ⇒ Google::Cloud::Firestore::Client

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 Authentication Guide.

Examples:

require "google/cloud"

firestore = Google::Cloud.firestore

Parameters:

  • project_id (String) (defaults to: nil)

    Identifier for a Firestore project. If not present, the default project for the credentials is used.

  • credentials (String, Hash, Google::Auth::Credentials) (defaults to: nil)

    The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Google::Cloud::Firestore::Credentials)

  • 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.

    The default scope is:

    • https://www.googleapis.com/auth/datastore
  • timeout (Integer) (defaults to: nil)

    Default timeout to use in requests. Optional.

Returns:



94
95
96
97
98
99
100
# 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

Instance Method Details

#firestore(scope: nil, timeout: nil) ⇒ Google::Cloud::Firestore::Client

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 Authentication Guide.

Examples:

require "google/cloud"

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

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

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.

    The default scope is:

    • https://www.googleapis.com/auth/datastore
  • timeout (Integer) (defaults to: nil)

    Default timeout to use in requests. Optional.

Returns:



61
62
63
# 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