Class: Inttegro::Resources::Customers
- Inherits:
-
Object
- Object
- Inttegro::Resources::Customers
- Defined in:
- lib/inttegro/resources/customers.rb
Overview
Client for reusable customer profiles.
Access this resource through Client#customers.
Instance Method Summary collapse
-
#create(payload) ⇒ Inttegro::Customer
Create a customer profile.
-
#initialize(http) ⇒ Customers
constructor
A new instance of Customers.
-
#lookup(customer_id:) ⇒ Inttegro::Customer
Retrieve one customer by identifier.
-
#page(payload = {}) ⇒ Inttegro::Customer::Page
Retrieve a page of customers.
-
#search(payload) ⇒ Inttegro::Search::Page
Search customer profiles using indexed fields and full-text matching.
-
#update(payload) ⇒ Inttegro::Customer
Update supplied fields on an existing customer profile.
Constructor Details
#initialize(http) ⇒ Customers
Returns a new instance of Customers.
11 12 13 |
# File 'lib/inttegro/resources/customers.rb', line 11 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#create(payload) ⇒ Inttegro::Customer
Create a customer profile.
19 20 21 |
# File 'lib/inttegro/resources/customers.rb', line 19 def create(payload) @http.post_resource("/customers/create", Inttegro::Customer, :customer, payload) end |
#lookup(customer_id:) ⇒ Inttegro::Customer
Retrieve one customer by identifier.
35 36 37 |
# File 'lib/inttegro/resources/customers.rb', line 35 def lookup(customer_id:) @http.post_resource("/customers/lookup", Inttegro::Customer, :customer, { customer_id: customer_id }) end |
#page(payload = {}) ⇒ Inttegro::Customer::Page
Retrieve a page of customers.
43 44 45 |
# File 'lib/inttegro/resources/customers.rb', line 43 def page(payload = {}) @http.post_resource("/customers/page", Inttegro::Customer::Page, :page, payload || {}) end |
#search(payload) ⇒ Inttegro::Search::Page
Search customer profiles using indexed fields and full-text matching.
51 52 53 |
# File 'lib/inttegro/resources/customers.rb', line 51 def search(payload) @http.post_resource("/customers/search", Inttegro::Search::Page, :search, payload) end |
#update(payload) ⇒ Inttegro::Customer
Update supplied fields on an existing customer profile.
27 28 29 |
# File 'lib/inttegro/resources/customers.rb', line 27 def update(payload) @http.post_resource("/customers/update", Inttegro::Customer, :customer, payload) end |