lib/kashflow_api/models/line.rb in kashflow_api-0.0.1 vs lib/kashflow_api/models/line.rb in kashflow_api-0.0.2

- old
+ new

@@ -3,10 +3,14 @@ def save if @hash["ReceiptID"] != "" insert_receipt_line elsif @hash["InvoiceID"] != "" insert_invoice_line + elsif @hash["InvoiceNumber"] != "" + insert_invoice_number_line + elsif @hash["ReceiptNumber"] != "" + insert_receipt_number_line end end def to_xml xml = [] @@ -22,17 +26,25 @@ end private def blank_object_hash - {"Quantity" => "", "Description" => "", "ChargeType" => "", "VatAmount" => "", "VatRate" => "", "Rate" => "", "ReceiptID" => "", "InvoiceID" => "" } + {"Quantity" => "", "Description" => "", "ChargeType" => "", "VatAmount" => "", "VatRate" => "", "Rate" => "", "ReceiptID" => "", "InvoiceID" => "", "InvoiceNumber" => "", "ReceiptNumber" => "" } end def insert_receipt_line KashflowApi.api.insert_receipt_line(self) end def insert_invoice_line KashflowApi.api.insert_invoice_line(self) + end + + def insert_invoice_number_line + KashflowApi.api.insert_invoice_line_with_invoice_number(self) + end + + def insert_receipt_number_line + KashflowApi.api.insert_receipt_line_from_number(self) end end end