Class: Cobrato::Resources::Charge

Inherits:
Base
  • Object
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

Constructor Details

This class inherits a constructor from Cobrato::Resources::Base

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

#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

#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