Class: Lightspeed::API::Items
- Inherits:
-
Object
- Object
- Lightspeed::API::Items
- Includes:
- Helpers::Pagination
- 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(limit: nil) ⇒ 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
Methods included from Helpers::Pagination
Constructor Details
#initialize(client) ⇒ Items
Returns a new instance of Items.
10 11 12 |
# File 'lib/lightspeed/api/items.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#all(limit: nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/lightspeed/api/items.rb', line 16 def all(limit: nil) with_pages(limit: limit) do || client.get("Account/#{client.account_id}/Item.json?#{}") end end |
#archive(item_id) ⇒ Object
30 31 32 |
# File 'lib/lightspeed/api/items.rb', line 30 def archive(item_id) client.delete("Account/#{client.account_id}/Item/#{item_id}.json").body end |
#create(attributes = {}) ⇒ Object
26 27 28 |
# File 'lib/lightspeed/api/items.rb', line 26 def create(attributes = {}) client.post("Account/#{client.account_id}/Item.json", body: attributes).body end |
#custom_fields ⇒ Object
14 |
# File 'lib/lightspeed/api/items.rb', line 14 def custom_fields; Items::CustomFields.new(client); end |
#find(item_id, with: []) ⇒ Object
22 23 24 |
# File 'lib/lightspeed/api/items.rb', line 22 def find(item_id, with: []) client.get("Account/#{client.account_id}/Item/#{item_id}.json", relations: with).body end |
#update(item_id, attributes = {}) ⇒ Object
34 35 36 |
# File 'lib/lightspeed/api/items.rb', line 34 def update(item_id, attributes = {}) client.put("Account/#{client.account_id}/Item/#{item_id}.json", body: attributes).body end |