Class: Io::Flow::V0::Clients::PaymentMethodRules
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::PaymentMethodRules
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #get_payment_and_method_and_rules(organization, incoming = {}) ⇒ Object
- #get_payment_method_rules(organization, incoming = {}) ⇒ Object
-
#initialize(client) ⇒ PaymentMethodRules
constructor
A new instance of PaymentMethodRules.
Constructor Details
#initialize(client) ⇒ PaymentMethodRules
Returns a new instance of PaymentMethodRules.
1712 1713 1714 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1712 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get_payment_and_method_and_rules(organization, incoming = {}) ⇒ Object
1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1733 def get_payment_and_method_and_rules(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, Array).map { |v| HttpClient::Preconditions.assert_class('country', v, String) }), :amount => (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "display_position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/payment/method/rules").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) } end |
#get_payment_method_rules(organization, incoming = {}) ⇒ Object
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1716 def get_payment_method_rules(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, Array).map { |v| HttpClient::Preconditions.assert_class('country', v, String) }), :amount => (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', x, String)), :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)), :experience => (x = opts.delete(:experience); x.nil? ? nil : HttpClient::Preconditions.assert_class('experience', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "display_position" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/payment-method-rules").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::PaymentMethodRule.new(x) } end |