Sha256: fd0e25042f54e08cc6186eb3c0b1051f9f97bf8a42cad17cf64b2c38f7fc505d
Contents?: true
Size: 890 Bytes
Versions: 19
Compression:
Stored size: 890 Bytes
Contents
module XeroGateway class Payment include Money include Dates # Any errors that occurred when the #valid? method called. attr_reader :errors # All accessible fields attr_accessor :date, :amount def initialize(params = {}) @errors ||= [] params.each do |k,v| self.send("#{k}=", v) end end def self.from_xml(payment_element) payment = Payment.new payment_element.children.each do | element | case element.name when 'Date' then payment.date = parse_date_time(element.text) when 'Amount' then payment.amount = BigDecimal.new(element.text) end end payment end def ==(other) [:date, :amount].each do |field| return false if send(field) != other.send(field) end return true end end end
Version data entries
19 entries across 19 versions & 2 rubygems