Class: Vend::Store

Inherits:
Object
  • Object
show all
Includes:
HasResources
Defined in:
lib/vend/store.rb

Instance Method Summary collapse

Methods included from HasResources

included

Constructor Details

#initialize(credentials = {}) ⇒ Store

Returns a new instance of Store.



9
10
11
12
13
14
15
16
17
# File 'lib/vend/store.rb', line 9

def initialize(credentials={})
  @authenticator = Vend::Config.auth_method
  case @authenticator
  when :basic_auth
    @name, @credentials = credentials[:store_name], [credentials[:username], credentials[:password]]
  when :oauth
    @name, @auth_token =  credentials[:store_name], credentials[:auth_token]
  end
end

Instance Method Details

#get(options) ⇒ Object

Dispatch a request using HTTP GET



21
22
23
# File 'lib/vend/store.rb', line 21

def get options
  dispatch :get, options
end

#post(options) ⇒ Object

Dispatch a request using HTTP POST



27
28
29
# File 'lib/vend/store.rb', line 27

def post options
  dispatch :post, options
end