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