lib/xero_gateway/contact.rb in xero_gateway-2.0.19 vs lib/xero_gateway/contact.rb in xero_gateway-2.1.0
- old
+ new
@@ -138,11 +138,11 @@
def to_xml(b = Builder::XmlMarkup.new)
b.Contact {
b.ContactID self.contact_id if self.contact_id
b.ContactNumber self.contact_number if self.contact_number
- b.Name self.name
+ b.Name self.name if self.name
b.EmailAddress self.email if self.email
b.FirstName self.first_name if self.first_name
b.LastName self.last_name if self.last_name
b.BankAccountDetails self.bank_account_details if self.bank_account_details
b.TaxNumber self.tax_number if self.tax_number
@@ -152,13 +152,13 @@
b.IsCustomer true if self.is_customer
b.IsSupplier true if self.is_supplier
b.DefaultCurrency if self.default_currency
b.Addresses {
addresses.each { |address| address.to_xml(b) }
- }
+ } if self.addresses.any?
b.Phones {
phones.each { |phone| phone.to_xml(b) }
- }
+ } if self.phones.any?
}
end
# Take a Contact element and convert it into an Contact object
def self.from_xml(contact_element, gateway = nil)