Class: Io::Flow::V0::Clients::OrganizationBankAccounts

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OrganizationBankAccounts

Returns a new instance of OrganizationBankAccounts.



7631
7632
7633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7631

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

Instance Method Details

#delete_by_key(organization, key) ⇒ Object



7664
7665
7666
7667
7668
7669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7664

def delete_by_key(organization, key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  r = @client.request("/#{CGI.escape(organization)}/bank/accounts/#{CGI.escape(key)}").delete
  nil
end

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



7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7635

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) }),
    :key => (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', 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)}/bank/accounts").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::OrganizationBankAccount.new(x) }
end

#get_by_key(organization, key) ⇒ Object



7649
7650
7651
7652
7653
7654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7649

def get_by_key(organization, key)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  r = @client.request("/#{CGI.escape(organization)}/bank/accounts/#{CGI.escape(key)}").get
  ::Io::Flow::V0::Models::OrganizationBankAccount.new(r)
end

#put_by_key(organization, key, bank_account_form) ⇒ Object



7656
7657
7658
7659
7660
7661
7662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7656

def put_by_key(organization, key, )
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('key', key, String)
  (x = ; x.is_a?(::Io::Flow::V0::Models::BankAccountForm) ? x : ::Io::Flow::V0::Models::BankAccountForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/bank/accounts/#{CGI.escape(key)}").with_json(.to_json).put
  ::Io::Flow::V0::Models::OrganizationBankAccount.new(r)
end