Class: JeraPayment::Api::Iugu::Customer

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

Constant Summary collapse

BASE_ENDPOINT =
'customers'

Class Method Summary collapse

Methods inherited from Base

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

Class Method Details

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



18
19
20
# File 'lib/jera_payment/api/iugu/customer.rb', line 18

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

.destroy(id, access_token = nil) ⇒ Object



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

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

  response = delete(url, access_token)
end

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



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

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

.show(id, access_token = nil) ⇒ Object



12
13
14
15
16
# File 'lib/jera_payment/api/iugu/customer.rb', line 12

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

  response = get(url, nil, access_token)
end

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



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

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

  response = put(url, body, access_token)
end