Class: ExtraLoop::Storage::RemoteStore

Inherits:
Object
  • Object
show all
Defined in:
lib/extraloop/redis-storage/remote_store.rb

Direct Known Subclasses

FusionTables

Constant Summary collapse

@@config =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials, options = {}) ⇒ RemoteStore

Returns a new instance of RemoteStore.



12
13
14
15
16
17
18
19
# File 'lib/extraloop/redis-storage/remote_store.rb', line 12

def initialize(credentials, options={})
  datastore = self.class.to_s.snake_case.split('/').last.to_sym
  load_config
  @options = options
  @credentials = credentials || config_for([:datastore, datastore])
  raise ExtraLoop::Storage::Exceptions::MissingCredentialsError.new "Missing credentials for '#{datastore}' remote store"  unless @credentials
  @api = nil
end

Class Method Details

.get_transport(datastore, credentials = nil, options = {}) ⇒ Object

Instanciates the relevant transport class for the selected datastore



7
8
9
10
# File 'lib/extraloop/redis-storage/remote_store.rb', line 7

def self.get_transport(datastore, credentials=nil, options={})
  classname = datastore.to_s.camel_case
  ExtraLoop::Storage.const_get(classname).new(credentials, options) if ExtraLoop::Storage.const_defined?(classname)
end