Sha256: 99ff5e485c352a3294434f7b2364b3a65360cd2a8f4d8c178b72adc55c7b498b
Contents?: true
Size: 1.36 KB
Versions: 16
Compression:
Stored size: 1.36 KB
Contents
module Braintree class PayPalAccountGateway def initialize(gateway) @gateway = gateway @config = gateway.config end def find(token) raise ArgumentError if token.nil? || token.to_s.strip == "" response = @config.http.get "/payment_methods/paypal_account/#{token}" PayPalAccount._new(@gateway, response[:paypal_account]) rescue NotFoundError raise NotFoundError, "payment method with token #{token.inspect} not found" end def update(token, attributes) Util.verify_keys(PayPalAccountGateway._update_signature, attributes) _do_update(:put, "/payment_methods/paypal_account/#{token}", :paypal_account => attributes) end def delete(token) @config.http.delete("/payment_methods/paypal_account/#{token}") end def _do_update(http_verb, url, params) # :nodoc: response = @config.http.send http_verb, url, params if response[:paypal_account] SuccessfulResult.new(:paypal_account => PayPalAccount._new(@gateway, response[:paypal_account])) elsif response[:api_error_response] ErrorResult.new(@gateway, response[:api_error_response]) else raise UnexpectedError, "expected :paypal_account or :api_error_response" end end def self._update_signature # :nodoc: options = [:make_default] [:token, {:options => options}] end end end
Version data entries
16 entries across 16 versions & 1 rubygems