Class: Io::Flow::V0::Clients::Transactions
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Transactions
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #get(organization, incoming = {}) ⇒ Object
-
#initialize(client) ⇒ Transactions
constructor
A new instance of Transactions.
Constructor Details
#initialize(client) ⇒ Transactions
Returns a new instance of Transactions.
8655 8656 8657 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8655 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization, incoming = {}) ⇒ Object
8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8659 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :statement_id => (x = opts.delete(:statement_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('statement_id', 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? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/billing/transactions").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Transaction.new(x) } end |