Class: Cardflex::SubscriptionGateway
- Inherits:
-
Object
- Object
- Cardflex::SubscriptionGateway
- Defined in:
- lib/cardflex/subscription_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) ⇒ SubscriptionGateway
constructor
A new instance of SubscriptionGateway.
- #request(attributes) ⇒ Object
Constructor Details
#initialize(gateway) ⇒ SubscriptionGateway
Returns a new instance of SubscriptionGateway.
5 6 7 8 |
# File 'lib/cardflex/subscription_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/subscription_gateway.rb', line 3 def config @config end |
Instance Method Details
#_handle_response(res) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/cardflex/subscription_gateway.rb', line 14 def _handle_response(res) if res[:response][:result] == '1' SuccessResponse.new(:subscription => Subscription.new(@gateway, res[:response])) else ErrorResponse.new(@gateway, res[:response]) end end |
#request(attributes) ⇒ Object
10 11 12 |
# File 'lib/cardflex/subscription_gateway.rb', line 10 def request(attributes) @config.http.post(attributes) end |