class TescoRb::Store

Attributes

address[R]

Public Class Methods

fields() click to toggle source
# File lib/tesco_rb/store.rb, line 9
def self.fields
  [:id, :name, :altIds, :region, :geo,
   :classification, :status, :facilities,
   :openingHours]
end
new(location) click to toggle source
# File lib/tesco_rb/store.rb, line 17
def initialize(location)
  set self.class.fields, location
  begin
    address_json = location.fetch('contact').
                   fetch('address')
    @address = Address.new(address_json)
  rescue KeyError => e
    p e
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/tesco_rb/store.rb, line 28
def ==(other)
  self.class.fields.all? do |method_name|
    send(method_name) == other.send(method_name)
  end
end