Class: Inttegro::Resources::Customers

Inherits:
Object
  • Object
show all
Defined in:
lib/inttegro/resources/customers.rb

Overview

Client for reusable customer profiles.

Access this resource through Client#customers.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Customers

Returns a new instance of Customers.

Parameters:



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.

Parameters:

Returns:



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.

Parameters:

  • customer_id (String) —

    unique customer identifier

Returns:



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.

Parameters:

Returns:



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.

Parameters:

Returns:



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.

Parameters:

Returns:



27
28
29
# File 'lib/inttegro/resources/customers.rb', line 27

def update(payload)
  @http.post_resource("/customers/update", Inttegro::Customer, :customer, payload)
end