Class: TuneupTechnology::Customers
- Defined in:
- lib/tuneuptechnology/customers.rb
Overview
The Customers object
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#make_http_request ⇒ Object
readonly
Returns the value of attribute make_http_request.
Attributes inherited from Client
#api_key, #email, #headers, #timeout, #version
Instance Method Summary collapse
-
#all ⇒ Object
Retrieve all customer records.
-
#create(data) ⇒ Object
Create a customer.
-
#delete(id) ⇒ Object
Delete a customer record.
-
#initialize(base_url, make_http_request) ⇒ Customers
constructor
A new instance of Customers.
-
#retrieve(id) ⇒ Object
Retrieve a single customer record.
-
#update(id, data) ⇒ Object
Update a customer record.
Methods inherited from Client
#customers, #inventory, #locations, make_http_request, #tickets
Constructor Details
#initialize(base_url, make_http_request) ⇒ Customers
Returns a new instance of Customers.
8 9 10 11 |
# File 'lib/tuneuptechnology/customers.rb', line 8 def initialize(base_url, make_http_request) @base_url = base_url @make_http_request = make_http_request end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/tuneuptechnology/customers.rb', line 6 def base_url @base_url end |
#make_http_request ⇒ Object (readonly)
Returns the value of attribute make_http_request.
6 7 8 |
# File 'lib/tuneuptechnology/customers.rb', line 6 def make_http_request @make_http_request end |
Instance Method Details
#all ⇒ Object
Retrieve all customer records
20 21 22 23 |
# File 'lib/tuneuptechnology/customers.rb', line 20 def all endpoint = "#{@base_url}/customers" Client.make_http_request('get', endpoint) end |
#create(data) ⇒ Object
Create a customer
14 15 16 17 |
# File 'lib/tuneuptechnology/customers.rb', line 14 def create(data) endpoint = "#{@base_url}/customers" Client.make_http_request('post', endpoint, data) end |
#delete(id) ⇒ Object
Delete a customer record
38 39 40 41 |
# File 'lib/tuneuptechnology/customers.rb', line 38 def delete(id) endpoint = "#{@base_url}/customers/#{id}" Client.make_http_request('delete', endpoint) end |
#retrieve(id) ⇒ Object
Retrieve a single customer record
26 27 28 29 |
# File 'lib/tuneuptechnology/customers.rb', line 26 def retrieve(id) endpoint = "#{@base_url}/customers/#{id}" Client.make_http_request('get', endpoint) end |
#update(id, data) ⇒ Object
Update a customer record
32 33 34 35 |
# File 'lib/tuneuptechnology/customers.rb', line 32 def update(id, data) endpoint = "#{@base_url}/customers/#{id}" Client.make_http_request('patch', endpoint, data) end |