class XeroGateway::ContactPerson

Attributes

email_address[RW]
first_name[RW]
include_in_emails[RW]
last_name[RW]

Public Class Methods

from_xml(contact_person_element) click to toggle source
# File lib/xero_gateway/contact_person.rb, line 20
def self.from_xml(contact_person_element)
  contact_person = ContactPerson.new
  contact_person_element.children.each do |element|
    case(element.name)
      when "FirstName"       then contact_person.first_name = element.text
      when "LastName"        then contact_person.last_name = element.text
      when "EmailAddress"    then contact_person.email_address = element.text
      when "IncludeInEmails" then contact_person.include_in_emails = (element.text == "true")
    end
  end
  contact_person
end
new(params = {}) click to toggle source
# File lib/xero_gateway/contact_person.rb, line 5
def initialize(params = {})
  params.each do |k,v|
    self.send("#{k}=", v)
  end
end

Public Instance Methods

to_xml(b = Builder::XmlMarkup.new) click to toggle source
# File lib/xero_gateway/contact_person.rb, line 11
def to_xml(b = Builder::XmlMarkup.new)
  b.ContactPerson {
    b.FirstName first_name if first_name
    b.LastName last_name if last_name
    b.EmailAddress email_address if email_address
    b.IncludeInEmails include_in_emails if include_in_emails
  }
end