Class: InsalesApi::Base

Inherits:
ActiveResource::Base
  • Object
show all
Extended by:
Resource::Countable, Resource::Paginated
Defined in:
lib/insales_api/base.rb

Class Method Summary collapse

Methods included from Resource::Countable

count

Methods included from Resource::Paginated

find_each, find_in_batches

Class Method Details

.configure(api_key, domain, password) ⇒ Object



21
22
23
24
25
26
# File 'lib/insales_api/base.rb', line 21

def configure(api_key, domain, password)
  self.user     = api_key
  self.site     = "http://#{domain}"
  self.password = password
  self
end

.dump_configObject



28
29
30
31
32
33
34
# File 'lib/insales_api/base.rb', line 28

def dump_config
  {
    user: self.user,
    site: self.site,
    password: self.password,
  }
end

.for_account(account) ⇒ Object



43
44
45
# File 'lib/insales_api/base.rb', line 43

def ()
  ActiveResourceProxy.new(, self)
end

.restore_config(options) ⇒ Object



36
37
38
39
40
41
# File 'lib/insales_api/base.rb', line 36

def restore_config(options)
  self.user     = options[:user]
  self.site     = options[:site]
  self.password = options[:password]
  true
end