class Lightspeed::API::Items

Attributes

client[R]

Public Class Methods

new(client) click to toggle source
# File lib/lightspeed/api/items.rb, line 10
def initialize(client)
  @client = client
end

Public Instance Methods

all(limit: nil) click to toggle source
# File lib/lightspeed/api/items.rb, line 16
def all(limit: nil)
  with_pages(limit: limit) do |options|
    client.get("Account/#{client.account_id}/Item.json?#{options}")
  end
end
archive(item_id) click to toggle source
# 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 = {}) click to toggle source
# 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() click to toggle source
# File lib/lightspeed/api/items.rb, line 14
def custom_fields; Items::CustomFields.new(client); end
find(item_id, with: []) click to toggle source
# 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 = {}) click to toggle source
# 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