Class: Cobrato::Resources::Charge
- Inherits:
-
Base
- Object
- Base
- Cobrato::Resources::Charge
show all
- Defined in:
- lib/cobrato/resources/charge.rb
Instance Attribute Summary
Attributes inherited from Base
#http
Instance Method Summary
collapse
Methods inherited from Base
#collection_name, #create, crud, #destroy, #initialize, #list, #parsed_body, #show, #update
Methods included from Hooks
#notify
Instance Method Details
#billet(id) ⇒ Object
25
26
27
28
29
|
# File 'lib/cobrato/resources/charge.rb', line 25
def billet(id)
http.get("#{resource_base_path}/#{id}/billet") do |response|
respond_with_openstruct response
end
end
|
#cancel(id) ⇒ Object
31
32
33
34
35
|
# File 'lib/cobrato/resources/charge.rb', line 31
def cancel(id)
http.post("#{resource_base_path}/#{id}/cancel") do |response|
respond_with_entity response
end
end
|
#deliver_billet(id, emails = nil) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/cobrato/resources/charge.rb', line 18
def deliver_billet(id, emails=nil)
body = {to: emails}
http.post("#{resource_base_path}/#{id}/deliver_billet", { body: body }) do |response|
response.code == 200
end
end
|
#receive(id, params) ⇒ Object
6
7
8
9
10
|
# File 'lib/cobrato/resources/charge.rb', line 6
def receive(id, params)
http.post("#{resource_base_path}/#{id}/receive", { body: params }) do |response|
respond_with_entity(response)
end
end
|
#renew(id, params) ⇒ Object
53
54
55
56
57
|
# File 'lib/cobrato/resources/charge.rb', line 53
def renew(id, params)
http.put("#{resource_base_path}/#{id}/renew", { body: params }) do |response|
respond_with_entity(response)
end
end
|
#retry(id) ⇒ Object
47
48
49
50
51
|
# File 'lib/cobrato/resources/charge.rb', line 47
def retry(id)
http.put("#{resource_base_path}/#{id}/retry") do |response|
response.code == 204
end
end
|
#revoke(id) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/cobrato/resources/charge.rb', line 37
def revoke(id)
http.post("#{resource_base_path}/#{id}/revoke") do |response|
if response.code == 200
respond_with_entity response
else
response.code == 204
end
end
end
|
#undo_receive(id) ⇒ Object
12
13
14
15
16
|
# File 'lib/cobrato/resources/charge.rb', line 12
def undo_receive(id)
http.post("#{resource_base_path}/#{id}/undo_receive") do |response|
respond_with_entity(response)
end
end
|