Class: KashflowApi::Line
- Inherits:
-
SoapObject
- Object
- SoapObject
- KashflowApi::Line
- Defined in:
- lib/kashflow_api/models/line.rb
Constant Summary collapse
- Keys =
[ "Quantity", "Description", "ChargeType", "VatAmount", "VatRate", "Rate", "ReceiptID", "InvoiceID", "InvoiceNumber", "ReceiptNumber" ]
- Finds =
[]
- KFObject =
{singular: "line", plural: "lines"}
- XMLKey =
"LineID"
Instance Attribute Summary
Attributes inherited from SoapObject
Instance Method Summary collapse
Methods inherited from SoapObject
all, define_methods, find, find_method, inherited, #initialize
Constructor Details
This class inherits a constructor from KashflowApi::SoapObject
Instance Method Details
#save ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kashflow_api/models/line.rb', line 13 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 |
#to_xml ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kashflow_api/models/line.rb', line 25 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 |