Class: LibTAD::Places::Location
- Inherits:
-
Object
- Object
- LibTAD::Places::Location
- Defined in:
- lib/types/places/location.rb
Overview
Information about a location.
Instance Attribute Summary collapse
-
#geo ⇒ Geo
readonly
Geographical information about the location.
-
#id ⇒ String
readonly
The id of the location.
-
#matchparam ⇒ String
readonly
The part of the queried placeid that this location matches.
-
#objects ⇒ Array<::LibTAD::Astronomy::AstronomyObject>
readonly
Astronomical information – sunrise and sunset times.
-
#time ⇒ ::LibTAD::TADTime::TADTime
readonly
Time information.
-
#timechanges ⇒ Array<::LibTAD::TADTime::TimeChange>
readonly
Time changes (daylight savings time).
Instance Method Summary collapse
-
#initialize(hash) ⇒ Location
constructor
A new instance of Location.
Constructor Details
#initialize(hash) ⇒ Location
Returns a new instance of Location.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/types/places/location.rb', line 29 def initialize(hash) @id = hash.fetch('id', nil) @matchparam = hash.fetch('matchparam', nil) @geo = Geo.new hash['geo'] unless !hash.key?('geo') @time = ::LibTAD::TADTime::TADTime.new hash['time'] unless !hash.key?('time') @timechanges = hash.fetch('timechanges', nil) &.map { |e| ::LibTAD::TADTime::TimeChange.new(e) } @objects = hash.fetch('astronomy', nil) &.fetch('objects', nil) &.map { |e| ::LibTAD::Astronomy::AstronomyObject.new(e) } end |
Instance Attribute Details
#geo ⇒ Geo (readonly)
Geographical information about the location.
15 16 17 |
# File 'lib/types/places/location.rb', line 15 def geo @geo end |
#id ⇒ String (readonly)
The id of the location.
7 8 9 |
# File 'lib/types/places/location.rb', line 7 def id @id end |
#matchparam ⇒ String (readonly)
The part of the queried placeid that this location matches.
11 12 13 |
# File 'lib/types/places/location.rb', line 11 def matchparam @matchparam end |
#objects ⇒ Array<::LibTAD::Astronomy::AstronomyObject> (readonly)
Astronomical information – sunrise and sunset times. Only for the timeservice and if requested.
27 28 29 |
# File 'lib/types/places/location.rb', line 27 def objects @objects end |
#time ⇒ ::LibTAD::TADTime::TADTime (readonly)
Time information. Only present if requested.
19 20 21 |
# File 'lib/types/places/location.rb', line 19 def time @time end |
#timechanges ⇒ Array<::LibTAD::TADTime::TimeChange> (readonly)
Time changes (daylight savings time). Only present if requested and information is available.
23 24 25 |
# File 'lib/types/places/location.rb', line 23 def timechanges @timechanges end |