Module: Google::Cloud::Firestore
- Defined in:
- 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/v1beta1.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/commit_response.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/v1beta1/doc/overview.rb,
lib/google/cloud/firestore/v1beta1/firestore_client.rb
Overview
Ruby Client for Google Cloud Firestore API (Beta)
Quick Start
In order to use this library, you first need to go through the following steps:
- Select or create a Cloud Platform project.
- Enable the Google Cloud Firestore API.
- Setup Authentication.
Installation
$ gem install google-cloud-firestore
Next Steps
- Read the Google Cloud Firestore API Product documentation to learn more about the product and see How-to Guides.
- View this repository's main README to see the full list of Cloud APIs that we cover.
Defined Under Namespace
Modules: V1beta1 Classes: Batch, Client, CollectionReference, CommitResponse, Credentials, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Query, Transaction
Constant Summary collapse
- VERSION =
"0.21.0".freeze
Class Method Summary collapse
-
.configure {|Google::Cloud.configure.firestore| ... } ⇒ Google::Cloud::Config
Configure the Google Cloud Firestore library.
-
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Firestore::Client
Creates a new object for connecting to the Firestore service.
Class Method Details
.configure {|Google::Cloud.configure.firestore| ... } ⇒ Google::Cloud::Config
Configure the Google Cloud Firestore library.
The following Firestore configuration parameters are supported:
project_id
- (String) Identifier for a Firestore project. (The parameterproject
is considered deprecated, but may also be used.)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. (See Credentials) (The parameterkeyfile
is considered deprecated, but may also be used.)scope
- (String, Array) The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. timeout
- (Integer) Default timeout to use in requests.client_config
- (Hash) A hash of values to override the default behavior of the API client.
540 541 542 543 544 |
# File 'lib/google/cloud/firestore.rb', line 540 def self.configure yield Google::Cloud.configure.firestore if block_given? Google::Cloud.configure.firestore end |
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: 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.
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/google/cloud/firestore.rb', line 497 def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, project: nil, keyfile: nil project_id ||= (project || default_project_id) project_id = project_id.to_s # Always cast to a string raise ArgumentError, "project_id is missing" if project_id.empty? scope ||= configure.scope timeout ||= configure.timeout client_config ||= configure.client_config credentials ||= (keyfile || default_credentials(scope: scope)) unless credentials.is_a? Google::Auth::Credentials credentials = Firestore::Credentials.new credentials, scope: scope end Firestore::Client.new( Firestore::Service.new( project_id, credentials, timeout: timeout, client_config: client_config ) ) end |