Module: CloudDatastore
- Defined in:
- lib/active_model/datastore/connection.rb
Overview
Returns a Google::Cloud::Datastore::Dataset object for the configured dataset.
The dataset instance is used to create, read, update, and delete entity objects.
GCLOUD_PROJECT is an environment variable representing the Datastore project ID. DATASTORE_KEYFILE_JSON is an environment variable that Datastore checks for credentials.
ENV = ‘
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIFfb3...5dmFtABy\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]"
‘
Class Method Summary collapse
Class Method Details
.dataset ⇒ Object
33 34 35 36 |
# File 'lib/active_model/datastore/connection.rb', line 33 def self.dataset timeout = ENV.fetch('DATASTORE_NETWORK_TIMEOUT', 15).to_i @dataset ||= Google::Cloud.datastore(timeout: timeout) end |
.reset_dataset ⇒ Object
38 39 40 |
# File 'lib/active_model/datastore/connection.rb', line 38 def self.reset_dataset @dataset = nil end |