Class: Alegra::Items
Instance Attribute Summary
Attributes inherited from Record
Instance Method Summary collapse
-
#create(params) ⇒ Hash
-
name [ String ] - description [ String ] - reference [ String ] - price [ Array ] - category [ Hash ] - inventory [ Hash ] - tax [ Array ].
-
- #delete(id) ⇒ Hash
- #find(id) ⇒ Hash
-
#list ⇒ Array
Return all items.
-
#update(id, params) ⇒ Hash
-
name [ String ] - description [ String ] - reference [ String ] - price [ Array ] - category [ Hash ] - inventory [ Hash ] - tax [ Array ].
-
Methods inherited from Record
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 ].
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
46 47 48 |
# File 'lib/alegra/items.rb', line 46 def delete(id) client.delete("items/#{ id }") end |
#find(id) ⇒ Hash
5 6 7 |
# File 'lib/alegra/items.rb', line 5 def find(id) client.get("items/#{ id }") end |
#list ⇒ Array
Return all items
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 ].
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 |