module Cardflex class CustomerVaultGateway attr_reader :config def initialize(gateway) @gateway = gateway @config = gateway.config end 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 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 end end