Module: Google::Cloud::Datastore
- Defined in:
- lib/google/cloud/datastore.rb,
lib/google/cloud/datastore/key.rb,
lib/google/cloud/datastore/query.rb,
lib/google/cloud/datastore/commit.rb,
lib/google/cloud/datastore/cursor.rb,
lib/google/cloud/datastore/entity.rb,
lib/google/cloud/datastore/errors.rb,
lib/google/cloud/datastore/convert.rb,
lib/google/cloud/datastore/dataset.rb,
lib/google/cloud/datastore/service.rb,
lib/google/cloud/datastore/version.rb,
lib/google/cloud/datastore/gql_query.rb,
lib/google/cloud/datastore/properties.rb,
lib/google/cloud/datastore/credentials.rb,
lib/google/cloud/datastore/transaction.rb,
lib/google/cloud/datastore/v1/doc/overview.rb,
lib/google/cloud/datastore/v1/datastore_client.rb,
lib/google/cloud/datastore/dataset/query_results.rb,
lib/google/cloud/datastore/read_only_transaction.rb,
lib/google/cloud/datastore/dataset/lookup_results.rb
Overview
Ruby Client for Google Cloud Datastore API (Alpha)
Google Cloud Datastore API: Accesses the schemaless NoSQL database to provide fully managed, robust, scalable storage for your application.
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 Datastore API.
- Setup Authentication.
Installation
$ gem install google-cloud-datastore
Next Steps
- Read the Google Cloud Datastore 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: V1 Classes: Commit, Credentials, Cursor, Dataset, Entity, GqlQuery, Key, KeyError, Properties, PropertyError, Query, ReadOnlyTransaction, Transaction, TransactionError
Constant Summary collapse
- VERSION =
"1.3.0"
Class Method Summary collapse
-
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, emulator_host: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Datastore::Dataset
Creates a new object for connecting to the Datastore service.
Class Method Details
.new(project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, emulator_host: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Datastore::Dataset
Creates a new object for connecting to the Datastore service. Each call creates a new connection.
For more information on connecting to Google Cloud see the Authentication Guide.
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/google/cloud/datastore.rb', line 613 def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, emulator_host: nil, project: nil, keyfile: nil project_id ||= (project || Datastore::Dataset.default_project_id) project_id = project_id.to_s # Always cast to a string fail ArgumentError, "project_id is missing" if project_id.empty? emulator_host ||= ENV["DATASTORE_EMULATOR_HOST"] if emulator_host return Datastore::Dataset.new( Datastore::Service.new( project_id, :this_channel_is_insecure, host: emulator_host, client_config: client_config)) end credentials ||= keyfile credentials ||= Datastore::Credentials.default(scope: scope) unless credentials.is_a? Google::Auth::Credentials credentials = Datastore::Credentials.new credentials, scope: scope end Datastore::Dataset.new( Datastore::Service.new( project_id, credentials, timeout: timeout, client_config: client_config)) end |