Module: Xfers::BankAccount

Defined in:
lib/xfers/bank_account.rb

Constant Summary collapse

RESOUCE_URL =
'/user/bank_account'

Class Method Summary collapse

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(, connect_key=nil)
  raise InvalidRequestError.new 'BankAccount id cannot be empty', 400 if .nil? or  == ''
  Xfers::APIOperations.delete "#{RESOUCE_URL}/#{}", 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(, params, connect_key=nil)
  raise InvalidRequestError.new 'BankAccount id cannot be empty', 400 if .nil? or  == ''
  Xfers::APIOperations.put params, "#{RESOUCE_URL}/#{}", 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(, params, connect_key=nil)
  raise InvalidRequestError.new 'BankAccount id and params cannot be empty', 400 if .nil? or params.nil?
  Xfers::APIOperations.post params, "#{RESOUCE_URL}/#{}/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