Class: KashflowApi::Receipt

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

Constant Summary collapse

Keys =
KashflowApi::Invoice::Keys
Finds =
KashflowApi::Invoice::Finds
KFObject =
{ singular: "receipt", plural: "receipts" }
XMLKey =
"InvoiceDBID"

Instance Attribute Summary

Attributes inherited from SoapObject

#hash

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SoapObject

all, define_methods, find, find_method, inherited, #initialize, #to_xml

Constructor Details

This class inherits a constructor from KashflowApi::SoapObject

Class Method Details

.build_arguments(action, object, field, argument) ⇒ Object



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

def self.build_arguments(action, object, field, argument)
  if action == "get"
    expects argument, String
    return "<ReceiptNumber>#{argument}</ReceiptNumber>" if object == "receipt"
  elsif action == "update" || action == "insert"
    expects argument, [KashflowApi::Receipt, KashflowApi::Line]
    return "<ReceiptID>#{argument.receiptid}</ReceiptID><InvLine>#{argument.to_xml}</InvLine>" if field == "Line"
    return "<ReceiptNumber>#{argument.invoicenumber}</ReceiptNumber><InvLine>#{argument.to_xml}</InvLine>" if field == "Number"
    return "<Inv>#{argument.to_xml}</Inv>" if object == "receipt"
  end
end

Instance Method Details

#saveObject



23
24
25
26
27
28
29
# File 'lib/kashflow_api/models/receipt.rb', line 23

def save
  if @hash["InvoiceDBID"] == "0"
    insert_receipt
  else
    update_receipt
  end
end