Class: Malipopay::Resources::Customers
- Inherits:
-
Object
- Object
- Malipopay::Resources::Customers
- Defined in:
- lib/malipopay/resources/customers.rb
Instance Method Summary collapse
-
#create(params) ⇒ Hash
Create a new customer.
-
#get(id) ⇒ Hash
Get a customer by ID.
-
#get_by_number(number) ⇒ Hash
Get a customer by customer number.
-
#get_by_phone(phone) ⇒ Hash
Get a customer by phone number.
-
#initialize(http_client) ⇒ Customers
constructor
A new instance of Customers.
-
#list(params = {}) ⇒ Hash
List all customers.
-
#search(params = {}) ⇒ Hash
Search customers.
-
#verify_customer(params) ⇒ Hash
Verify a customer.
Constructor Details
#initialize(http_client) ⇒ Customers
Returns a new instance of Customers.
6 7 8 |
# File 'lib/malipopay/resources/customers.rb', line 6 def initialize(http_client) @http = http_client end |
Instance Method Details
#create(params) ⇒ Hash
Create a new customer
13 14 15 |
# File 'lib/malipopay/resources/customers.rb', line 13 def create(params) @http.post("/api/v1/customer", body: params) end |
#get(id) ⇒ Hash
Get a customer by ID
27 28 29 |
# File 'lib/malipopay/resources/customers.rb', line 27 def get(id) @http.get("/api/v1/customer/#{id}") end |
#get_by_number(number) ⇒ Hash
Get a customer by customer number
34 35 36 |
# File 'lib/malipopay/resources/customers.rb', line 34 def get_by_number(number) @http.get("/api/v1/customer/search", params: { customerNumber: number }) end |
#get_by_phone(phone) ⇒ Hash
Get a customer by phone number
41 42 43 |
# File 'lib/malipopay/resources/customers.rb', line 41 def get_by_phone(phone) @http.get("/api/v1/customer/search", params: { phone: phone }) end |
#list(params = {}) ⇒ Hash
List all customers
20 21 22 |
# File 'lib/malipopay/resources/customers.rb', line 20 def list(params = {}) @http.get("/api/v1/customer", params: params) end |
#search(params = {}) ⇒ Hash
Search customers
48 49 50 |
# File 'lib/malipopay/resources/customers.rb', line 48 def search(params = {}) @http.get("/api/v1/customer/search", params: params) end |
#verify_customer(params) ⇒ Hash
Verify a customer
55 56 57 |
# File 'lib/malipopay/resources/customers.rb', line 55 def verify_customer(params) @http.post("/api/v1/customer/verify", body: params) end |