Class: Lightspeed::API::Items

Inherits:
Object
  • Object
show all
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

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

#allObject



12
13
14
# File 'lib/lightspeed/api/items.rb', line 12

def all
  client.get("Account/#{client.}/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.}/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.}/Item.json", body: attributes).body
end

#custom_fieldsObject



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.}/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.}/Item/#{item_id}.json", body: attributes).body
end