Class: Zazu::Resources::Customers

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

Overview

Customers — individuals or businesses the entity invoices.

Constant Summary

Constants inherited from Base

Base::MAX_PER_PAGE

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Zazu::Resources::Base

Instance Method Details

#create(**attributes) ⇒ Object

POST /api/customers

Parameters:

  • attributes (Hash)

    customer attributes — see API docs. Common keys: customer_type (“individual”|“business”), person_name, company_name, email, phone, tax_id, ice_number, billing_address (Hash with street/city/postal_code/country/country_code).



25
26
27
# File 'lib/zazu/resources/customers.rb', line 25

def create(**attributes)
  http_post("api/customers", body: attributes)
end

#delete(id) ⇒ Object

DELETE /api/customers/:id



35
36
37
# File 'lib/zazu/resources/customers.rb', line 35

def delete(id)
  http_delete(encode_path("api/customers", id))
end

#get(id) ⇒ Object

GET /api/customers/:id



15
16
17
# File 'lib/zazu/resources/customers.rb', line 15

def get(id)
  http_get(encode_path("api/customers", id))
end

#list(q: nil, limit: MAX_PER_PAGE, cursor: nil) ⇒ Object

GET /api/customers

Parameters:

  • q (String, nil) (defaults to: nil)

    search query (matches company name, person name, email)



10
11
12
# File 'lib/zazu/resources/customers.rb', line 10

def list(q: nil, limit: MAX_PER_PAGE, cursor: nil)
  list_page("api/customers", q: q, limit: limit, cursor: cursor)
end

#update(id, **attributes) ⇒ Object

PATCH /api/customers/:id



30
31
32
# File 'lib/zazu/resources/customers.rb', line 30

def update(id, **attributes)
  http_patch(encode_path("api/customers", id), body: attributes)
end