Class: MeteofranceApi::Place
- Inherits:
-
Object
- Object
- MeteofranceApi::Place
- Defined in:
- lib/meteofrance_api/models/place.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
country code of the place.
-
#insee ⇒ Object
readonly
INSEE ID of the place.
-
#latitude ⇒ Object
readonly
latitude of the place.
-
#longitude ⇒ Object
readonly
longitude of the place.
-
#name ⇒ Object
readonly
name of the place.
-
#postal_code ⇒ Object
readonly
postal code of the place.
-
#province ⇒ Object
readonly
Province/Region of the place.
-
#province_code ⇒ Object
readonly
Province/Region’s numerical code of the place.
Instance Method Summary collapse
-
#initialize(data) ⇒ Place
constructor
A new instance of Place.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Place
Returns a new instance of Place.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/meteofrance_api/models/place.rb', line 20 def initialize(data) @insee = data["insee"] @name = data["name"] @latitude = data["lat"] @longitude = data["lon"] @country = data["country"] @province = data["admin"] @province_code = data["admin2"] @postal_code = data["postCode"] end |
Instance Attribute Details
#country ⇒ Object (readonly)
country code of the place.
12 13 14 |
# File 'lib/meteofrance_api/models/place.rb', line 12 def country @country end |
#insee ⇒ Object (readonly)
INSEE ID of the place.
4 5 6 |
# File 'lib/meteofrance_api/models/place.rb', line 4 def insee @insee end |
#latitude ⇒ Object (readonly)
latitude of the place.
8 9 10 |
# File 'lib/meteofrance_api/models/place.rb', line 8 def latitude @latitude end |
#longitude ⇒ Object (readonly)
longitude of the place.
10 11 12 |
# File 'lib/meteofrance_api/models/place.rb', line 10 def longitude @longitude end |
#name ⇒ Object (readonly)
name of the place.
6 7 8 |
# File 'lib/meteofrance_api/models/place.rb', line 6 def name @name end |
#postal_code ⇒ Object (readonly)
postal code of the place.
18 19 20 |
# File 'lib/meteofrance_api/models/place.rb', line 18 def postal_code @postal_code end |
#province ⇒ Object (readonly)
Province/Region of the place.
14 15 16 |
# File 'lib/meteofrance_api/models/place.rb', line 14 def province @province end |
#province_code ⇒ Object (readonly)
Province/Region’s numerical code of the place.
16 17 18 |
# File 'lib/meteofrance_api/models/place.rb', line 16 def province_code @province_code end |
Instance Method Details
#to_s ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/meteofrance_api/models/place.rb', line 31 def to_s if country == "FR" "#{name} - #{admin} (#{admin2}) - #{country}" else "#{name} - #{admin} - #{country}" end end |