Class: JeraPayment::Api::Iugu::PaymentMethod

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

Class Method Summary collapse

Methods inherited from Base

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

Class Method Details

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



18
19
20
21
22
# File 'lib/jera_payment/api/iugu/payment_method.rb', line 18

def self.create(customer_id, body = {}, access_token = nil)
  url = "customers/#{customer_id}/payment_methods"

  response = post(url, body, access_token)
end

.destroy(customer_id, id, access_token = nil) ⇒ Object



30
31
32
33
34
# File 'lib/jera_payment/api/iugu/payment_method.rb', line 30

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

  response = delete(url, access_token)
end

.index(customer_id, access_token = nil) ⇒ Object



6
7
8
9
10
# File 'lib/jera_payment/api/iugu/payment_method.rb', line 6

def self.index(customer_id, access_token = nil)
  url = "customers/#{customer_id}/payment_methods"

  response = get(url, nil, access_token)
end

.show(customer_id, id, access_token = nil) ⇒ Object



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

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

  response = get(url, nil, access_token)
end

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



24
25
26
27
28
# File 'lib/jera_payment/api/iugu/payment_method.rb', line 24

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

  response = put(url, body, access_token)
end