Sha256: 63b28edc885496422e0d0f77063ac68796972d2c968529053e1bf1cb1a061b01

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 Bytes

Contents

module XeroGateway
  class Phone
    attr_accessor :phone_type, :number, :area_code, :country_code
    
    def initialize(params = {})
      params = {
        :phone_type => "DEFAULT"
      }.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
    end
    
    def ==(other)
      [:phone_type, :number, :area_code, :country_code].each do |field|
        return false if send(field) != other.send(field)
      end
      return true
    end    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tlconnor-xero_gateway-1.0.1 lib/xero_gateway/phone.rb
tlconnor-xero_gateway-1.0.2 lib/xero_gateway/phone.rb
tlconnor-xero_gateway-1.0.3 lib/xero_gateway/phone.rb