Class: Io::Flow::V0::Clients::PaymentPaymentMethods
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::PaymentPaymentMethods
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(organization, incoming = {}) ⇒ Object
Returns available payment methods.
-
#initialize(client) ⇒ PaymentPaymentMethods
constructor
A new instance of PaymentPaymentMethods.
Constructor Details
#initialize(client) ⇒ PaymentPaymentMethods
Returns a new instance of PaymentPaymentMethods.
7876 7877 7878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7876 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization, incoming = {}) ⇒ Object
Returns available payment methods.
7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7881 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)), :merchant_of_record => (x = opts.delete(:merchant_of_record); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x)).value) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/payment/methods").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentPaymentMethod.new(x) } end |