class XeroGateway::Account
Constants
- ACCOUNT_CLASS
- STATUSES
- TAX_TYPE
- TYPE
Attributes
account_class[RW]
account_id[RW]
code[RW]
currency_code[RW]
description[RW]
enable_payments_to_account[RW]
name[RW]
status[RW]
system_account[RW]
tax_type[RW]
type[RW]
Public Class Methods
from_xml(account_element)
click to toggle source
# File lib/xero_gateway/account.rb, line 82 def self.from_xml(account_element) account = Account.new account_element.children.each do |element| case(element.name) when "AccountID" then account.account_id = element.text when "Code" then account.code = element.text when "Name" then account.name = element.text when "Type" then account.type = element.text when "Status" then account.status = element.text when "Class" then account.account_class = element.text when "TaxType" then account.tax_type = element.text when "Description" then account.description = element.text when "SystemAccount" then account.system_account = element.text when "EnablePaymentsToAccount" then account.enable_payments_to_account = (element.text == 'true') when "CurrencyCode" then account.currency_code = element.text end end account end
new(params = {})
click to toggle source
# File lib/xero_gateway/account.rb, line 53 def initialize(params = {}) params.each do |k,v| self.send("#{k}=", v) end end
Public Instance Methods
==(other)
click to toggle source
# File lib/xero_gateway/account.rb, line 59 def ==(other) [:account_id, :code, :name, :type, :status, :account_class, :tax_type, :description, :system_account, :enable_payments_to_account].each do |field| return false if send(field) != other.send(field) end return true end
to_xml(b = Builder::XmlMarkup.new, options={})
click to toggle source
# File lib/xero_gateway/account.rb, line 66 def to_xml(b = Builder::XmlMarkup.new, options={}) b.tag!(options[:name] ? options[:name] : 'Account') { b.AccountID self.account_id b.Code self.code b.Name self.name b.Type self.type b.Status self.status b.Class self.account_class b.TaxType self.tax_type b.Description self.description b.SystemAccount self.system_account unless self.system_account.nil? b.EnablePaymentsToAccount self.enable_payments_to_account b.CurrencyCode currency_code if currency_code } end