Module: Invoicexpress::Client::Items
- Included in:
- Invoicexpress::Client
- Defined in:
- lib/invoicexpress/client/items.rb
Instance Method Summary collapse
-
#create_item(item, options = {}) ⇒ Invoicexpress::Models::Item
Creates a new item.
-
#delete_item(item, options = {}) ⇒ Object
Deletes an item.
-
#item(item, options = {}) ⇒ Invoicexpress::Models::Item
Returns a specific item.
-
#items(options = {}) ⇒ Array<Invoicexpress::Models::Item>
Returns a list of all your items.
-
#update_item(item, options = {}) ⇒ Invoicexpress::Models::Item
Updates an item.
Instance Method Details
#create_item(item, options = {}) ⇒ Invoicexpress::Models::Item
Creates a new item. Regarding item taxes, if the tax name is not found, no tax is applied to that item.
36 37 38 39 40 41 |
# File 'lib/invoicexpress/client/items.rb', line 36 def create_item(item, ={}) raise(ArgumentError, "item has the wrong type") unless item.is_a?(Invoicexpress::Models::Item) params = { :klass => Invoicexpress::Models::Item, :body => item } post("items.xml", params.merge()) end |
#delete_item(item, options = {}) ⇒ Object
Deletes an item.
62 63 64 65 |
# File 'lib/invoicexpress/client/items.rb', line 62 def delete_item(item, ={}) params = { :klass => Invoicexpress::Models::Item } delete("items/#{id_from_item(item)}.xml", params.merge()) end |
#item(item, options = {}) ⇒ Invoicexpress::Models::Item
Returns a specific item.
23 24 25 26 27 |
# File 'lib/invoicexpress/client/items.rb', line 23 def item(item, ={}) params = { :klass => Invoicexpress::Models::Item } get("items/#{id_from_item(item)}.xml", params.merge()) end |
#items(options = {}) ⇒ Array<Invoicexpress::Models::Item>
Returns a list of all your items.
11 12 13 14 15 |
# File 'lib/invoicexpress/client/items.rb', line 11 def items( = {}) params = { :klass => Invoicexpress::Models::Item } get("items.xml", params.merge()) end |
#update_item(item, options = {}) ⇒ Invoicexpress::Models::Item
Updates an item.
50 51 52 53 54 55 |
# File 'lib/invoicexpress/client/items.rb', line 50 def update_item(item, ={}) raise(ArgumentError, "item has the wrong type") unless item.is_a?(Invoicexpress::Models::Item) params = { :klass => Invoicexpress::Models::Item, :body => item } put("items/#{item.id}.xml", params.merge()) end |