Class: KashflowApi::Invoice
Direct Known Subclasses
Quote
Constant Summary
collapse
- Keys =
[
"InvoiceNumber", "InvoiceDate", "DueDate", "CustomerID", "CustomerReference", ["InvoiceDBID", "0"]
]
- Finds =
[ "InvoiceNumber" ]
- KFObject =
{ singular: "invoice", plural: "invoices" }
- 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
Class Method Details
.build_arguments(action, object, field, argument) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/kashflow_api/models/invoice.rb', line 15
def self.build_arguments(action, object, field, argument)
if action == "get"
expects argument, String
return "<InvoiceNumber>#{argument}</InvoiceNumber>" if object == "invoice"
elsif action == "update" || action == "insert"
expects argument, [KashflowApi::Invoice, KashflowApi::Line]
return "<InvoiceID>#{argument.invoiceid}</InvoiceID><InvLine>#{argument.to_xml}</InvLine>" if field == "Line"
return "<InvoiceNumber>#{argument.invoicenumber}</InvoiceNumber><InvLine>#{argument.to_xml}</InvLine>" if field == "Number"
return "<Inv>#{argument.to_xml}</Inv>" if object == "invoice"
end
end
|
Instance Method Details
#customer ⇒ Object
27
28
29
|
# File 'lib/kashflow_api/models/invoice.rb', line 27
def customer
KashflowApi::Customer.find_by_customer_id(self.customerid)
end
|
#save ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/kashflow_api/models/invoice.rb', line 31
def save
if @hash["InvoiceDBID"] == "0"
insert_invoice
else
update_invoice
end
end
|