Class: GcDatastore::DatastoreFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/gc_datastore/datastore_factory.rb

Constant Summary collapse

VERSION =
'v1beta2'
@@INSTANCE =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.getObject



6
7
8
9
# File 'lib/gc_datastore/datastore_factory.rb', line 6

def self.get
  @@INSTANCE = new unless @@INSTANCE
  @@INSTANCE
end

Instance Method Details

#create(options) ⇒ Object



11
12
13
# File 'lib/gc_datastore/datastore_factory.rb', line 11

def create(options)
  return GcDatastore::Datastore.new(newRemoteRpc(options))
end

#makeClient(options) ⇒ Object



21
22
23
24
# File 'lib/gc_datastore/datastore_factory.rb', line 21

def makeClient(options)
  client = GcDatastore::Client.new(options).authorize(options)
  return client
end

#newRemoteRpc(options) ⇒ Object



15
16
17
18
19
# File 'lib/gc_datastore/datastore_factory.rb', line 15

def newRemoteRpc(options)
  client = makeClient(options)
  datastore = client.discovered_api('datastore', VERSION) 
  return GcDatastore::Datastore.new(GcDatastore::RemoteRpc.new(client, options))
end