Class: KashflowApi::Line

Inherits:
SoapObject show all
Defined in:
lib/kashflow_api/models/line.rb

Instance Attribute Summary

Attributes inherited from SoapObject

#hash

Instance Method Summary collapse

Methods inherited from SoapObject

build_from_soap, #initialize, #method_missing

Constructor Details

This class inherits a constructor from KashflowApi::SoapObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class KashflowApi::SoapObject

Instance Method Details

#saveObject



3
4
5
6
7
8
9
# File 'lib/kashflow_api/models/line.rb', line 3

def save
    if @hash["ReceiptID"] != ""
        insert_receipt_line
    elsif @hash["InvoiceID"] != ""
        insert_invoice_line
    end
end

#to_xmlObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/kashflow_api/models/line.rb', line 11

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