Class: Cardflex::PlanGateway
- Inherits:
-
Object
- Object
- Cardflex::PlanGateway
- Defined in:
- lib/cardflex/plan_gateway.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #_handle_response(res) ⇒ Object
-
#initialize(gateway) ⇒ PlanGateway
constructor
A new instance of PlanGateway.
- #request(attributes) ⇒ Object
Constructor Details
#initialize(gateway) ⇒ PlanGateway
Returns a new instance of PlanGateway.
5 6 7 8 |
# File 'lib/cardflex/plan_gateway.rb', line 5 def initialize(gateway) @gateway = gateway @config = gateway.config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/cardflex/plan_gateway.rb', line 3 def config @config end |
Instance Method Details
#_handle_response(res) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/cardflex/plan_gateway.rb', line 15 def _handle_response(res) if res[:response][:result] == '1' SuccessResponse.new(:plan => Plan.new(@gateway, res[:response])) else ErrorResponse.new(@gatway, res[:response]) end end |
#request(attributes) ⇒ Object
10 11 12 13 |
# File 'lib/cardflex/plan_gateway.rb', line 10 def request(attributes) res = config.http.post(attributes) _handle_response(res) end |