Class: Cardflex::CustomerVaultGateway
- Inherits:
-
Object
- Object
- Cardflex::CustomerVaultGateway
- Defined in:
- lib/cardflex/customer_vault_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) ⇒ CustomerVaultGateway
constructor
A new instance of CustomerVaultGateway.
- #request(attributes) ⇒ Object
Constructor Details
#initialize(gateway) ⇒ CustomerVaultGateway
Returns a new instance of CustomerVaultGateway.
5 6 7 8 |
# File 'lib/cardflex/customer_vault_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/customer_vault_gateway.rb', line 3 def config @config end |
Instance Method Details
#_handle_response(res) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/cardflex/customer_vault_gateway.rb', line 18 def _handle_response(res) if res[:response][:result] == '1' SuccessResponse.new(:customer_vault => CustomerVault.new(@gateway, res[:response])) else ErrorResponse.new(@gateway, res[:response]) end end |
#request(attributes) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/cardflex/customer_vault_gateway.rb', line 10 def request(attributes) root = attributes.keys[0] raise ArgumentError, 'missing redirect_url' unless attributes[root][:redirect_url] raise ArgumentError, 'missing customer_vault_id' unless attributes[root][:customer_vault_id] @config.http.post(attributes) end |