Class: GmxCheckout::Base
- Inherits:
-
Object
- Object
- GmxCheckout::Base
- Defined in:
- lib/gmxcheckout/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
-
#initialize(api) ⇒ Base
constructor
A new instance of Base.
- #prepare!(params) ⇒ Object
- #process_body(response) ⇒ Object
- #process_transaction(response) ⇒ Object
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
#api ⇒ Object (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 |