Class: KashflowApi::Supplier

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

Constant Summary collapse

Keys =
[
  "Code", "Name", "Contact", "Telephone", "Mobile", "Fax", "Email", "Address1", "Address2", "Address3", "Address4", "Postcode", "Website", "VATNumber", "Notes"
]
Finds =
[ "code", "id" ]
KFObject =
{ singular: "supplier", plural: "suppliers" }
XMLKey =
"SupplierID"

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



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kashflow_api/models/supplier.rb', line 13

def self.build_arguments(action, object, field, argument)
  if action == "get"
    expects argument, String
    return "<Supplier#{field}>#{argument}</Supplier#{field}>" if object == "supplier"
    return "<#{field}>#{argument}</#{field}>" if object == "suppliers"
  elsif action == "update"
    expects argument, KashflowApi::Supplier
    return "<sup>#{argument.to_xml}</sup>" if object == "supplier"
  elsif action == "insert"
    expects argument, KashflowApi::Supplier
    return "<supl>#{argument.to_xml}</supl>" if object == "supplier"
  end
end

Instance Method Details

#saveObject



27
28
29
30
31
32
33
# File 'lib/kashflow_api/models/supplier.rb', line 27

def save
  if @hash["SupplierID"] == "0"
    insert_supplier
  else
    update_supplier
  end 
end