Module: Invoicexpress::Client::Taxes
- Included in:
- Invoicexpress::Client
- Defined in:
- lib/invoicexpress/client/taxes.rb
Instance Method Summary collapse
-
#create_tax(tax, options = {}) ⇒ Object
Creates a tax.
-
#delete_tax(tax, options = {}) ⇒ Object
Deletes a tax.
-
#tax(tax, options = {}) ⇒ Object
Returns a specific tax.
-
#taxes(options = {}) ⇒ Array<Invoicexpress::Models::Tax>
Returns all your taxes (lol).
-
#update_tax(tax, options = {}) ⇒ Object
Updates a tax.
Instance Method Details
#create_tax(tax, options = {}) ⇒ Object
Creates a tax.
33 34 35 36 37 38 |
# File 'lib/invoicexpress/client/taxes.rb', line 33 def create_tax(tax, ={}) raise(ArgumentError, "tax has the wrong type") unless tax.is_a?(Invoicexpress::Models::Tax) params = { :klass => Invoicexpress::Models::Tax, :body => tax } post("taxes.xml", params.merge()) end |
#delete_tax(tax, options = {}) ⇒ Object
Deletes a tax.
61 62 63 64 65 |
# File 'lib/invoicexpress/client/taxes.rb', line 61 def delete_tax(tax, ={}) params = { :klass => Invoicexpress::Models::Tax } delete("taxes/#{id_from_tax(tax)}.xml", params.merge()) end |
#tax(tax, options = {}) ⇒ Object
Returns a specific tax.
21 22 23 24 25 |
# File 'lib/invoicexpress/client/taxes.rb', line 21 def tax(tax, ={}) params = { :klass => Invoicexpress::Models::Tax } get("taxes/#{id_from_tax(tax)}.xml", params.merge()) end |
#taxes(options = {}) ⇒ Array<Invoicexpress::Models::Tax>
Returns all your taxes (lol)
9 10 11 12 13 |
# File 'lib/invoicexpress/client/taxes.rb', line 9 def taxes( = {}) params = { :klass => Invoicexpress::Models::Tax } get("taxes.xml", params.merge()) end |
#update_tax(tax, options = {}) ⇒ Object
Updates a tax.
46 47 48 49 50 51 52 53 54 |
# File 'lib/invoicexpress/client/taxes.rb', line 46 def update_tax(tax, ={}) raise(ArgumentError, "tax has the wrong type") unless tax.is_a?(Invoicexpress::Models::Tax) if !tax.id raise ArgumentError, "Tax ID is required" end params = { :klass => Invoicexpress::Models::Tax, :body => tax } put("taxes/#{tax.id}.xml", params.merge()) end |