Class: Lightspeed::API::Items
- Inherits:
-
Object
- Object
- Lightspeed::API::Items
- Defined in:
- lib/lightspeed/api/items.rb,
lib/lightspeed/api/items/custom_fields.rb,
lib/lightspeed/api/items/custom_fields/custom_field_choices.rb
Defined Under Namespace
Classes: CustomFields
Instance Method Summary collapse
- #all ⇒ Object
- #archive(item_id) ⇒ Object
- #create(attributes = {}) ⇒ Object
- #custom_fields ⇒ Object
- #find(item_id, with: []) ⇒ Object
-
#initialize(client) ⇒ Items
constructor
A new instance of Items.
- #update(item_id, attributes = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Items
Returns a new instance of Items.
6 7 8 |
# File 'lib/lightspeed/api/items.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#all ⇒ Object
12 13 14 |
# File 'lib/lightspeed/api/items.rb', line 12 def all client.get("Account/#{client.account_id}/Item.json").body end |
#archive(item_id) ⇒ Object
24 25 26 |
# File 'lib/lightspeed/api/items.rb', line 24 def archive(item_id) client.delete("Account/#{client.account_id}/Item/#{item_id}.json").body end |
#create(attributes = {}) ⇒ Object
20 21 22 |
# File 'lib/lightspeed/api/items.rb', line 20 def create(attributes = {}) client.post("Account/#{client.account_id}/Item.json", body: attributes).body end |
#custom_fields ⇒ Object
10 |
# File 'lib/lightspeed/api/items.rb', line 10 def custom_fields; Items::CustomFields.new(client); end |
#find(item_id, with: []) ⇒ Object
16 17 18 |
# File 'lib/lightspeed/api/items.rb', line 16 def find(item_id, with: []) client.get("Account/#{client.account_id}/Item/#{item_id}.json", relations: with).body end |
#update(item_id, attributes = {}) ⇒ Object
28 29 30 |
# File 'lib/lightspeed/api/items.rb', line 28 def update(item_id, attributes = {}) client.put("Account/#{client.account_id}/Item/#{item_id}.json", body: attributes).body end |