Sha256: fa0899ad1ddbc84b1e44d3355b2ed64193fd6ebd1ad67aecdf312b106523a9c0
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
module XeroGateway class Invoice # All accessible fields attr_accessor :invoice_id, :invoice_number, :invoice_type, :invoice_status, :date, :due_date, :reference, :tax_inclusive, :includes_tax, :sub_total, :total_tax, :total, :line_items, :contact def initialize(params = {}) params = { :contact => Contact.new, :date => Time.now, :includes_tax => true, :tax_inclusive => true }.merge(params) params.each do |k,v| self.instance_variable_set("@#{k}", v) ## create and initialize an instance variable for this key/value pair self.send("#{k}=", v) end @line_items ||= [] end def ==(other) ["invoice_number", "invoice_type", "invoice_status", "reference", "tax_inclusive", "includes_tax", "sub_total", "total_tax", "total", "contact", "line_items"].each do |field| return false if send(field) != other.send(field) end ["date", "due_date"].each do |field| return false if send(field).to_s != other.send(field).to_s end return true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tlconnor-xero_gateway-1.0.1 | lib/xero_gateway/invoice.rb |
tlconnor-xero_gateway-1.0.2 | lib/xero_gateway/invoice.rb |