Sha256: 3749af7d0bb3ba86bae18bc06b22121ba82fa33f80b523451fd87ee09d1b6859
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
module KashflowApi class Line < KashflowApi::SoapObject 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 = [] id_line = "" @hash.keys.each do |key| if key == "LineID" id_line = "<#{key}>#{@hash[key]}</#{key}>" unless @hash[key] == "0" elsif key != "ReceiptID" && key != "InvoiceID" && @hash[key] != "" xml.push("<#{key}>#{@hash[key]}</#{key}>") end end [id_line, xml.join].join end private def blank_object_hash {"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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kashflow_api-0.0.3 | lib/kashflow_api/models/line.rb |
kashflow_api-0.0.2 | lib/kashflow_api/models/line.rb |