Class: Data::Location
- Inherits:
-
Object
- Object
- Data::Location
- Defined in:
- lib/barometer/data/location.rb
Overview
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
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#id ⇒ Object
Returns the value of attribute id.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state_code ⇒ Object
Returns the value of attribute state_code.
-
#state_name ⇒ Object
Returns the value of attribute state_name.
-
#zip_code ⇒ Object
Returns the value of attribute zip_code.
Instance Method Summary collapse
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
11 12 13 |
# File 'lib/barometer/data/location.rb', line 11 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
12 13 14 |
# File 'lib/barometer/data/location.rb', line 12 def country @country end |
#country_code ⇒ Object
Returns the value of attribute country_code.
12 13 14 |
# File 'lib/barometer/data/location.rb', line 12 def country_code @country_code end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/barometer/data/location.rb', line 11 def id @id end |
#latitude ⇒ Object
Returns the value of attribute latitude.
13 14 15 |
# File 'lib/barometer/data/location.rb', line 13 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
13 14 15 |
# File 'lib/barometer/data/location.rb', line 13 def longitude @longitude end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/barometer/data/location.rb', line 11 def name @name end |
#state_code ⇒ Object
Returns the value of attribute state_code.
12 13 14 |
# File 'lib/barometer/data/location.rb', line 12 def state_code @state_code end |
#state_name ⇒ Object
Returns the value of attribute state_name.
12 13 14 |
# File 'lib/barometer/data/location.rb', line 12 def state_name @state_name end |
#zip_code ⇒ Object
Returns the value of attribute zip_code.
12 13 14 |
# File 'lib/barometer/data/location.rb', line 12 def zip_code @zip_code end |
Instance Method Details
#coordinates ⇒ Object
15 16 17 |
# File 'lib/barometer/data/location.rb', line 15 def coordinates [@latitude, @longitude].join(',') end |
#to_s ⇒ Object
19 20 21 22 |
# File 'lib/barometer/data/location.rb', line 19 def to_s [@name, @city, @state_name || @state_cocde, @country || @country_code].compact.join(', ') end |