Class: Io::Flow::V0::Clients::OrganizationPayouts

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OrganizationPayouts

Returns a new instance of OrganizationPayouts.



7745
7746
7747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7745

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get(organization, incoming = {}) ⇒ Object



7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7749

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) }),
    :since => (x = opts.delete(:since); x.nil? ? nil : HttpClient::Preconditions.assert_class('since', HttpClient::Helper.to_date_time_iso8601(x), DateTime)),
    :updated_since => (x = opts.delete(:updated_since); x.nil? ? nil : HttpClient::Preconditions.assert_class('updated_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("/#{CGI.escape(organization)}/billing/payouts").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::OrganizationPayout.new(x) }
end

#get_by_id(organization, id) ⇒ Object



7764
7765
7766
7767
7768
7769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7764

def get_by_id(organization, id)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  r = @client.request("/#{CGI.escape(organization)}/billing/payouts/#{CGI.escape(id)}").get
  ::Io::Flow::V0::Models::OrganizationPayout.new(r)
end