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