Class: Gyftwrapper::API

Inherits:
Object
  • Object
show all
Includes:
Resultable
Defined in:
lib/gyftwrapper/api.rb

Constant Summary collapse

CALLS =
{
  purchase_card: '/reseller/purchase/card'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAPI

Returns a new instance of API.



19
20
21
22
# File 'lib/gyftwrapper/api.rb', line 19

def initialize
  self.result = Result.new
  self.config = parse_config_file
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



17
18
19
# File 'lib/gyftwrapper/api.rb', line 17

def config
  @config
end

#resultObject

Returns the value of attribute result.



17
18
19
# File 'lib/gyftwrapper/api.rb', line 17

def result
  @result
end

Instance Method Details

#purchase_card(params) ⇒ Object



24
25
26
27
28
# File 'lib/gyftwrapper/api.rb', line 24

def purchase_card(params)
  send_request do
    RestClient.post(url_for(:purchase_card), params.merge(default_params), 'x-sig-timestamp' => timestamp)
  end
end