Class: PaymentGateway::Mundipagg::Customer

Inherits:
Base
  • Object
show all
Defined in:
lib/payment_gateway/mundipagg/customer.rb

Constant Summary

Constants inherited from Base

Base::API_URL

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from PaymentGateway::Mundipagg::Base

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/payment_gateway/mundipagg/customer.rb', line 21

def any?
  list&.any?
end

#create(customer_data) ⇒ Object



25
26
27
28
# File 'lib/payment_gateway/mundipagg/customer.rb', line 25

def create(customer_data)
  creation_url = "#{API_URL}/customers"
  request(:post, creation_url, body: create_customer_body(customer_data))
end

#find(options) ⇒ Object



10
11
12
13
# File 'lib/payment_gateway/mundipagg/customer.rb', line 10

def find(options)
  list_url = "#{API_URL}/customers"
  request(:get, list_url, params: options)
end

#listObject



15
16
17
18
19
# File 'lib/payment_gateway/mundipagg/customer.rb', line 15

def list
  list_url = "#{API_URL}/customers"
  response = request(:get, list_url)
  response.parse['data']
end

#show(customer_id) ⇒ Object



5
6
7
8
# File 'lib/payment_gateway/mundipagg/customer.rb', line 5

def show(customer_id)
  url = "#{API_URL}/customers/#{customer_id}"
  request(:get, url)
end