Class: Io::Flow::V0::Clients::ChannelStatements
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ChannelStatements
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #get(channel, incoming = {}) ⇒ Object
- #get_by_id(channel, id) ⇒ Object
-
#initialize(client) ⇒ ChannelStatements
constructor
A new instance of ChannelStatements.
Constructor Details
#initialize(client) ⇒ ChannelStatements
Returns a new instance of ChannelStatements.
6051 6052 6053 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6051 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(channel, incoming = {}) ⇒ Object
6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6055 def get(channel, incoming={}) HttpClient::Preconditions.assert_class('channel', channel, 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) }), :since => (x = opts.delete(:since); x.nil? ? nil : HttpClient::Preconditions.assert_class('since', HttpClient::Helper.to_date_time_iso8601(x), DateTime)), :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("/channel/#{CGI.escape(channel)}/billing/statements").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ChannelStatement.new(x) } end |
#get_by_id(channel, id) ⇒ Object
6069 6070 6071 6072 6073 6074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6069 def get_by_id(channel, id) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/channel/#{CGI.escape(channel)}/billing/statements/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::ChannelStatement.new(r) end |