Class: JeraPayment::Api::Iugu::Invoice

Inherits:
Base
  • Object
show all
Defined in:
lib/jera_payment/api/iugu/invoice.rb

Constant Summary collapse

BASE_ENDPOINT =
'invoices'

Class Method Summary collapse

Methods inherited from Base

delete, ensure_account_access_token, get, parse_response, post, put, set_headers

Class Method Details

.cancel(id, access_token = nil) ⇒ Object



34
35
36
37
38
# File 'lib/jera_payment/api/iugu/invoice.rb', line 34

def self.cancel(id, access_token = nil)
  url = "#{BASE_ENDPOINT}/#{id}/cancel"

  response = put(url, nil, access_token)
end

.capture(id, access_token = nil) ⇒ Object



28
29
30
31
32
# File 'lib/jera_payment/api/iugu/invoice.rb', line 28

def self.capture(id, access_token = nil)
  url = "#{BASE_ENDPOINT}/#{id}/capture"

  response = post(url, nil, access_token)
end

.create(body = {}, access_token = nil) ⇒ Object



12
13
14
# File 'lib/jera_payment/api/iugu/invoice.rb', line 12

def self.create(body = {}, access_token = nil)
  response = post(BASE_ENDPOINT, body, access_token)
end

.duplicate(id, body = {}, access_token = nil) ⇒ Object



22
23
24
25
26
# File 'lib/jera_payment/api/iugu/invoice.rb', line 22

def self.duplicate(id, body = {}, access_token = nil)
  url = "#{BASE_ENDPOINT}/#{id}/duplicate"

  response = post(url, body, access_token)
end

.index(query = nil, access_token = nil) ⇒ Object



8
9
10
# File 'lib/jera_payment/api/iugu/invoice.rb', line 8

def self.index(query = nil, access_token = nil)
  response = get(BASE_ENDPOINT, query, access_token)
end

.refund(id, access_token = nil) ⇒ Object



40
41
42
43
44
# File 'lib/jera_payment/api/iugu/invoice.rb', line 40

def self.refund(id, access_token = nil)
  url = "#{BASE_ENDPOINT}/#{id}/refund"

  response = post(url, nil, access_token)
end

.send_email(id, access_token = nil) ⇒ Object



46
47
48
49
50
# File 'lib/jera_payment/api/iugu/invoice.rb', line 46

def self.send_email(id, access_token = nil)
  url = "#{BASE_ENDPOINT}/#{id}/send_email"

  response = post(url, nil, access_token)
end

.show(id, access_token = nil) ⇒ Object



16
17
18
19
20
# File 'lib/jera_payment/api/iugu/invoice.rb', line 16

def self.show(id, access_token = nil)
  url = "#{BASE_ENDPOINT}/#{id}"

  response = get(url, nil, access_token)
end