lib/barometer/data/location.rb in barometer-0.8.0 vs lib/barometer/data/location.rb in barometer-0.9.0

- old
+ new

@@ -1,25 +1,19 @@ module Barometer - # - # A simple Location class - # - # Used to store location information about the station that - # gave the measurement data for a weather query, or the location - # that was queried - # - class Data::Location + module Data + class Location < Coordinates + attribute :id, String + attribute :name, String + attribute :city, String + attribute :state_name, String + attribute :state_code, String + attribute :country, String + attribute :country_code, String + attribute :zip_code, String - attr_accessor :id, :name, :city - attr_accessor :state_name, :state_code, :country, :country_code, :zip_code - attr_accessor :latitude, :longitude - - def coordinates - [@latitude, @longitude].join(',') + def to_s + [name, city, state_name || state_code, + country || country_code].compact.join(', ') + end end - - def to_s - [@name, @city, @state_name || @state_cocde, - @country || @country_code].compact.join(', ') - end - end end