Class: Alegra::Items

Inherits:
Record show all
Defined in:
lib/alegra/items.rb

Instance Attribute Summary

Attributes inherited from Record

#client

Instance Method Summary collapse

Methods inherited from Record

#initialize

Constructor Details

This class inherits a constructor from Alegra::Record

Instance Method Details

#create(params) ⇒ Hash

Returns - name [ String ]

  • description [ String ]

  • reference [ String ]

  • price [ Array ]

  • category [ Hash ]

  • inventory [ Hash ]

  • tax [ Array ].

Parameters:

Returns:

  • (Hash)
    • name [ String ]

    • description [ String ]

    • reference [ String ]

    • price [ Array ]

    • category [ Hash ]

    • inventory [ Hash ]

    • tax [ Array ]



24
25
26
27
# File 'lib/alegra/items.rb', line 24

def create(params)
  _params = params.deep_camel_case_lower_keys
  client.post('items', _params)
end

#delete(id) ⇒ Hash

Parameters:

  • id (Integer)

Returns:



46
47
48
# File 'lib/alegra/items.rb', line 46

def delete(id)
  client.delete("items/#{ id }")
end

#find(id) ⇒ Hash

Parameters:

  • id (Integer)

Returns:



5
6
7
# File 'lib/alegra/items.rb', line 5

def find(id)
  client.get("items/#{ id }")
end

#listArray

Return all items

Returns:



11
12
13
# File 'lib/alegra/items.rb', line 11

def list()
  client.get('items')
end

#update(id, params) ⇒ Hash

Returns - name [ String ]

  • description [ String ]

  • reference [ String ]

  • price [ Array ]

  • category [ Hash ]

  • inventory [ Hash ]

  • tax [ Array ].

Parameters:

  • id (Integer)
  • params (Hash)

Returns:

  • (Hash)
    • name [ String ]

    • description [ String ]

    • reference [ String ]

    • price [ Array ]

    • category [ Hash ]

    • inventory [ Hash ]

    • tax [ Array ]



39
40
41
42
# File 'lib/alegra/items.rb', line 39

def update(id, params)
  _params = params.deep_camel_case_lower_keys
  client.put("items/#{ id }", _params)
end