Module: Teamlab::CrmInvoices
Overview
Methods for working with crm invoices
Instance Method Summary collapse
-
#check_invoice_existence_by_number(number) ⇒ Boolean
Returns the existence of an invoice with the number specified in the request.
- #create_invoice(number, issue_date, client_id, due_date, language, currency, exchange_rate, terms, invoice_line, options = {}) ⇒ Object
- #create_invoice_item(title, description, price, stock_keeping_unit, options = {}) ⇒ Object
- #create_invoice_line(invoice_id, invoice_item_id, options = {}) ⇒ Object
- #create_invoice_tax(name, description, options = {}) ⇒ Object
- #delete_batch_invoices(*invoice_ids) ⇒ Object (also: #delete_invoices_bulk)
- #delete_batch_items(*ids) ⇒ Object (also: #delete_invoice_items_bulk)
- #delete_invoice(id) ⇒ Object
- #delete_invoice_item(id) ⇒ Object
- #delete_invoice_line(id) ⇒ Object
- #delete_invoice_tax(id) ⇒ Object
- #get_entity_invoices(entity_type, entity_id) ⇒ Object
- #get_invoice_by_id(id) ⇒ Object
-
#get_invoice_by_number(number) ⇒ Hash
Returns the detailed information about an invoice with the number specified in the request.
- #get_invoice_item_by_id(invoice_item_id) ⇒ Void
- #get_invoice_items_by_filter(options = {}) ⇒ Object
- #get_invoice_sample ⇒ Object
- #get_invoice_taxes ⇒ Object
- #get_invoices_by_filter(options = {}) ⇒ Object
- #get_invoices_settings ⇒ Object (also: #get_settings)
- #save_number_settings(options = {}) ⇒ Object
- #save_terms_settings(options = {}) ⇒ Object
- #update_invoice(id, options = {}) ⇒ Object
-
#update_invoice_group_status(status, invoice_ids) ⇒ Teamlab::Response
Updates the status of invoices with the IDs specified in the request.
- #update_invoice_item(id, title, description, price, stock_keeping_unit, options = {}) ⇒ Object
- #update_invoice_line(invoice_line_id, invoice_id, options = {}) ⇒ Object
- #update_invoice_tax(id, name, options = {}) ⇒ Object
Instance Method Details
#check_invoice_existence_by_number(number) ⇒ Boolean
Returns the existence of an invoice with the number specified in the request
124 125 126 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 124 def check_invoice_existence_by_number(number) @request.get(%w[invoice bynumber exist], number: number) end |
#create_invoice(number, issue_date, client_id, due_date, language, currency, exchange_rate, terms, invoice_line, options = {}) ⇒ Object
38 39 40 41 42 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 38 def create_invoice(number, issue_date, client_id, due_date, language, currency, exchange_rate, terms, invoice_line, = {}) @request.post(%w[invoice], { number: number, issueDate: issue_date, contactId: client_id, dueDate: due_date, language: language, currency: currency, exchangeRate: exchange_rate, terms: terms, invoiceLines: invoice_line }.merge()) end |
#create_invoice_item(title, description, price, stock_keeping_unit, options = {}) ⇒ Object
48 49 50 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 48 def create_invoice_item(title, description, price, stock_keeping_unit, = {}) @request.post(%w[invoiceitem], { title: title, description: description, price: price, sku: stock_keeping_unit.to_s }.merge()) end |
#create_invoice_line(invoice_id, invoice_item_id, options = {}) ⇒ Object
44 45 46 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 44 def create_invoice_line(invoice_id, invoice_item_id, = {}) @request.post(%w[invoiceline], { invoiceId: invoice_id, invoiceItemId: invoice_item_id }.merge()) end |
#create_invoice_tax(name, description, options = {}) ⇒ Object
52 53 54 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 52 def create_invoice_tax(name, description, = {}) @request.post(%w[invoice tax], { name: name, description: description }.merge()) end |
#delete_batch_invoices(*invoice_ids) ⇒ Object Also known as: delete_invoices_bulk
89 90 91 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 89 def delete_batch_invoices(*invoice_ids) @request.delete(%w[invoice], invoiceids: invoice_ids.flatten) end |
#delete_batch_items(*ids) ⇒ Object Also known as: delete_invoice_items_bulk
94 95 96 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 94 def delete_batch_items(*ids) @request.delete(%w[invoiceitem], ids: ids.flatten) end |
#delete_invoice(id) ⇒ Object
107 108 109 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 107 def delete_invoice(id) @request.delete(['invoice', id.to_s]) end |
#delete_invoice_item(id) ⇒ Object
99 100 101 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 99 def delete_invoice_item(id) @request.delete(['invoiceitem', id.to_s]) end |
#delete_invoice_line(id) ⇒ Object
111 112 113 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 111 def delete_invoice_line(id) @request.delete(['invoiceline', id.to_s]) end |
#delete_invoice_tax(id) ⇒ Object
103 104 105 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 103 def delete_invoice_tax(id) @request.delete(['invoice', 'tax', id.to_s]) end |
#get_entity_invoices(entity_type, entity_id) ⇒ Object
34 35 36 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 34 def get_entity_invoices(entity_type, entity_id) @request.get([entity_type.to_s, 'invoicelist', entity_id.to_s]) end |
#get_invoice_by_id(id) ⇒ Object
30 31 32 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 30 def get_invoice_by_id(id) @request.get(['invoice', id.to_s]) end |
#get_invoice_by_number(number) ⇒ Hash
Returns the detailed information about an invoice with the number specified in the request
131 132 133 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 131 def get_invoice_by_number(number) @request.get(%w[invoice bynumber], number: number) end |
#get_invoice_item_by_id(invoice_item_id) ⇒ Void
117 118 119 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 117 def get_invoice_item_by_id(invoice_item_id) @request.get(['invoiceitem', invoice_item_id]) end |
#get_invoice_items_by_filter(options = {}) ⇒ Object
26 27 28 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 26 def get_invoice_items_by_filter( = {}) @request.get(%w[invoiceitem filter], ) end |
#get_invoice_sample ⇒ Object
10 11 12 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 10 def get_invoice_sample @request.get(%w[invoice sample]) end |
#get_invoice_taxes ⇒ Object
6 7 8 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 6 def get_invoice_taxes @request.get(%w[invoice tax]) end |
#get_invoices_by_filter(options = {}) ⇒ Object
14 15 16 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 14 def get_invoices_by_filter( = {}) @request.get(%w[invoice filter], ) end |
#get_invoices_settings ⇒ Object Also known as: get_settings
18 19 20 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 18 def get_invoices_settings @request.get(%w[invoice settings]) end |
#save_number_settings(options = {}) ⇒ Object
68 69 70 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 68 def save_number_settings( = {}) @request.put(%w[invoice settings name], ) end |
#save_terms_settings(options = {}) ⇒ Object
72 73 74 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 72 def save_terms_settings( = {}) @request.put(%w[invoice settings terms], ) end |
#update_invoice(id, options = {}) ⇒ Object
64 65 66 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 64 def update_invoice(id, = {}) @request.put(['invoice', id.to_s], ) end |
#update_invoice_group_status(status, invoice_ids) ⇒ Teamlab::Response
Updates the status of invoices with the IDs specified in the request
80 81 82 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 80 def update_invoice_group_status(status, invoice_ids) @request.put(['invoice', 'status', status.to_s], invoiceids: invoice_ids) end |
#update_invoice_item(id, title, description, price, stock_keeping_unit, options = {}) ⇒ Object
56 57 58 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 56 def update_invoice_item(id, title, description, price, stock_keeping_unit, = {}) @request.put(['invoiceitem', id.to_s], { title: title, description: description, price: price, sku: stock_keeping_unit.to_s }.merge()) end |
#update_invoice_line(invoice_line_id, invoice_id, options = {}) ⇒ Object
84 85 86 87 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 84 def update_invoice_line(invoice_line_id, invoice_id, = {}) [:invoiceId] = invoice_id @request.put(['invoiceline', invoice_line_id], ) end |
#update_invoice_tax(id, name, options = {}) ⇒ Object
60 61 62 |
# File 'lib/teamlab/modules/crm/crm_invoices.rb', line 60 def update_invoice_tax(id, name, = {}) @request.put(['invoice', 'tax', id.to_s], { name: name }.merge()) end |