Class: Io::Flow::V0::Clients::ChannelBankAccounts
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ChannelBankAccounts
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_key(channel, key) ⇒ Object
- #get(channel, incoming = {}) ⇒ Object
- #get_by_key(channel, key) ⇒ Object
-
#initialize(client) ⇒ ChannelBankAccounts
constructor
A new instance of ChannelBankAccounts.
- #put_by_key(channel, key, bank_account_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ ChannelBankAccounts
Returns a new instance of ChannelBankAccounts.
5869 5870 5871 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5869 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_key(channel, key) ⇒ Object
5902 5903 5904 5905 5906 5907 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5902 def delete_by_key(channel, key) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/channel/#{CGI.escape(channel)}/bank/accounts/#{CGI.escape(key)}").delete nil end |
#get(channel, incoming = {}) ⇒ Object
5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5873 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) }), :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("/channel/#{CGI.escape(channel)}/bank/accounts").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ChannelBankAccount.new(x) } end |
#get_by_key(channel, key) ⇒ Object
5887 5888 5889 5890 5891 5892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5887 def get_by_key(channel, key) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('key', key, String) r = @client.request("/channel/#{CGI.escape(channel)}/bank/accounts/#{CGI.escape(key)}").get ::Io::Flow::V0::Models::ChannelBankAccount.new(r) end |
#put_by_key(channel, key, bank_account_form) ⇒ Object
5894 5895 5896 5897 5898 5899 5900 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5894 def put_by_key(channel, key, bank_account_form) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('key', key, String) (x = bank_account_form; x.is_a?(::Io::Flow::V0::Models::BankAccountForm) ? x : ::Io::Flow::V0::Models::BankAccountForm.new(x)) r = @client.request("/channel/#{CGI.escape(channel)}/bank/accounts/#{CGI.escape(key)}").with_json(bank_account_form.to_json).put ::Io::Flow::V0::Models::ChannelBankAccount.new(r) end |