Class: Bankaccounts

Inherits:
OpenPayResource show all
Defined in:
lib/openpay/bankaccounts.rb

Instance Attribute Summary

Attributes inherited from OpenPayResource

#api_hook

Instance Method Summary collapse

Methods inherited from OpenPayResource

#env, #errors?, #get_with_custom_url, #hash2json, #initialize, #json2hash, #post, #put

Constructor Details

This class inherits a constructor from OpenPayResource

Instance Method Details

#all(customer_id) ⇒ Object



33
34
35
36
# File 'lib/openpay/bankaccounts.rb', line 33

def all(customer_id)
  customers=@api_hook.create(:customers)
  customers.all_bank_accounts(customer_id)
end

#create(bank_account, customer_id) ⇒ Object



5
6
7
8
# File 'lib/openpay/bankaccounts.rb', line 5

def create(,customer_id)
  customers=@api_hook.create(:customers)
  customers.(customer_id,)
end

#delete(customer_id, bank_account) ⇒ Object



21
22
23
24
# File 'lib/openpay/bankaccounts.rb', line 21

def delete(customer_id,)
  customers=@api_hook.create(:customers)
  customers.(customer_id,)
end

#delete_all(customer_id) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/openpay/bankaccounts.rb', line 47

def delete_all(customer_id)

  if env == :production
    raise OpenpayException.new('This method is not supported on PRODUCTION',false)
  end

  customers=@api_hook.create(:customers)
  customers.delete_all_bank_accounts(customer_id)

end

#each(customer_id) ⇒ Object



26
27
28
29
30
31
# File 'lib/openpay/bankaccounts.rb', line 26

def each(customer_id)
  customers=@api_hook.create(:customers)
   customers.(customer_id)  do |acc|
     yield acc
   end
end

#get(customer_id = '', bank_account = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/openpay/bankaccounts.rb', line 10

def get(customer_id='',=nil)
  customers=@api_hook.create(:customers)

  if 
    customers.(customer_id,)
  else
    customers.(customer_id)
  end

end

#list(search_params, customer_id = nil) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/openpay/bankaccounts.rb', line 38

def list(search_params,customer_id=nil)
  if customer_id
    customers=@api_hook.create(:customers)
    customers.list_bankaccounts(customer_id,search_params)
  else
    super search_params
  end
end