Module: Xfers::BankAccount
- Defined in:
- lib/xfers/bank_account.rb
Constant Summary collapse
- RESOUCE_URL =
'/user/bank_account'
Class Method Summary collapse
- .add(params, connect_key = nil) ⇒ Object
- .delete(bank_account_id, connect_key = nil) ⇒ Object
- .list_all(connect_key = nil) ⇒ Object
- .update(bank_account_id, params, connect_key = nil) ⇒ Object
- .withdraw(bank_account_id, params, connect_key = nil) ⇒ Object
- .withdrawal_requests(params = nil, connect_key = nil) ⇒ Object
Class Method Details
.add(params, connect_key = nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/xfers/bank_account.rb', line 10 def self.add(params, connect_key=nil) raise InvalidRequestError.new 'Params cannot be empty', 400 if params.nil? or params == '' params['redirect'] = 'false' Xfers::APIOperations.post params, RESOUCE_URL, connect_key end |
.delete(bank_account_id, connect_key = nil) ⇒ Object
21 22 23 24 |
# File 'lib/xfers/bank_account.rb', line 21 def self.delete(bank_account_id, connect_key=nil) raise InvalidRequestError.new 'BankAccount id cannot be empty', 400 if bank_account_id.nil? or bank_account_id == '' Xfers::APIOperations.delete "#{RESOUCE_URL}/#{bank_account_id}", connect_key end |
.list_all(connect_key = nil) ⇒ Object
6 7 8 |
# File 'lib/xfers/bank_account.rb', line 6 def self.list_all(connect_key=nil) Xfers::APIOperations.get(nil, RESOUCE_URL, connect_key) end |
.update(bank_account_id, params, connect_key = nil) ⇒ Object
16 17 18 19 |
# File 'lib/xfers/bank_account.rb', line 16 def self.update(bank_account_id, params, connect_key=nil) raise InvalidRequestError.new 'BankAccount id cannot be empty', 400 if bank_account_id.nil? or bank_account_id == '' Xfers::APIOperations.put params, "#{RESOUCE_URL}/#{bank_account_id}", connect_key end |
.withdraw(bank_account_id, params, connect_key = nil) ⇒ Object
26 27 28 29 |
# File 'lib/xfers/bank_account.rb', line 26 def self.withdraw(bank_account_id, params, connect_key=nil) raise InvalidRequestError.new 'BankAccount id and params cannot be empty', 400 if bank_account_id.nil? or params.nil? Xfers::APIOperations.post params, "#{RESOUCE_URL}/#{bank_account_id}/withdraw", connect_key end |
.withdrawal_requests(params = nil, connect_key = nil) ⇒ Object
31 32 33 |
# File 'lib/xfers/bank_account.rb', line 31 def self.withdrawal_requests(params=nil, connect_key=nil) Xfers::APIOperations.get(params, "#{RESOUCE_URL}/withdrawal_requests", connect_key)[:withdrawal_requests] end |