Class: CardsPe
Instance Attribute Summary
#api_hook
Instance Method Summary
collapse
#env, #errors?, #get_with_custom_url, #hash2json, #initialize, #json2hash, #post, #put
Instance Method Details
#all(customer_id = nil) ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'lib/openpay/peru/cards_pe.rb', line 55
def all(customer_id=nil)
if customer_id
customers=@api_hook.create(:customers)
customers.all_cards(customer_id)
else
super ''
end
end
|
#create(card, customer_id = nil) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/openpay/peru/cards_pe.rb', line 14
def create(card,customer_id=nil)
if customer_id
customers=@api_hook.create(:customers)
customers.create_card(customer_id,card)
else
super card
end
end
|
#delete(card_id, customer_id = nil) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/openpay/peru/cards_pe.rb', line 23
def delete(card_id,customer_id=nil)
if customer_id
customers=@api_hook.create(:customers)
customers.delete_card(customer_id,card_id)
else
super card_id
end
end
|
#delete_all(customer_id = nil) ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/openpay/peru/cards_pe.rb', line 32
def delete_all(customer_id=nil)
if customer_id
customers=@api_hook.create(:customers)
customers.delete_all_cards(customer_id)
else
each do |card|
delete(card['id'])
end
end
end
|
#each(customer_id = nil) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/openpay/peru/cards_pe.rb', line 43
def each(customer_id=nil)
if customer_id
all(customer_id).each do |card|
yield card
end
else
all.each do |card|
yield card
end
end
end
|
#get(card = '', customer_id = nil) ⇒ Object
5
6
7
8
9
10
11
12
|
# File 'lib/openpay/peru/cards_pe.rb', line 5
def get(card='',customer_id=nil)
if customer_id
customers=@api_hook.create(:customers)
customers.get_card(customer_id,card)
else
super card
end
end
|
#list(search_params, customer_id = nil) ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/openpay/peru/cards_pe.rb', line 64
def list(search_params,customer_id=nil)
if customer_id
customers=@api_hook.create(:customers)
customers.list_cards(customer_id,search_params)
else
super search_params
end
end
|