class Ensconce::Adapter
Parent class for adapters.
Specific adapters should inherit from this class
Attributes
params[R]
settings[R]
Public Class Methods
config(options = {})
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 14 def self.config(options = {}) @options = options return self end
for(settings_object, params = {})
click to toggle source
The object passed to for should have methods that return the settings for each instance connection. For example, a user object with an id used to retrieve data for that user.
# File lib/ensconce/adapters/adapter.rb, line 22 def self.for(settings_object, params = {}) new(:settings => settings_object, :params => params) end
new(args = {})
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 9 def initialize(args = {}) @settings = args[:settings] @params = args[:params] end
options()
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 26 def self.options @options || {} end
options=(data)
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 30 def self.options=(data) @options = data end
Public Instance Methods
get(*args)
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 38 def get(*args) raise_define_method_error('get') end
options()
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 34 def options self.class.options end
push(*args)
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 42 def push(*args) raise_define_method_error('push') end
Private Instance Methods
raise_define_method_error(name)
click to toggle source
# File lib/ensconce/adapters/adapter.rb, line 48 def raise_define_method_error(name) raise "Adapter instance method '#{name}' needs to be defined" end