Class: GmxCheckout::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gmxcheckout/base.rb

Direct Known Subclasses

Subscriptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/gmxcheckout/base.rb', line 5

def initialize(api)
  @api = api
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



3
4
5
# File 'lib/gmxcheckout/base.rb', line 3

def api
  @api
end

Instance Method Details

#prepare!(params) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/gmxcheckout/base.rb', line 17

def prepare!(params)
  params.tap do |hash|
    hash['empresa.hashEmpresa'] = api.key
    hash['restApi'] = true
    hash.compact!
  end
end

#process_body(response) ⇒ Object



13
14
15
# File 'lib/gmxcheckout/base.rb', line 13

def process_body(response)
  Hashie::Mash.new response.body
end

#process_transaction(response) ⇒ Object



9
10
11
# File 'lib/gmxcheckout/base.rb', line 9

def process_transaction(response)
  Response.new response.body, Models::Transaction
end