Class: LibTAD::Places::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/types/places/location.rb

Overview

Information about a location.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#geoGeo (readonly)

Geographical information about the location.

Returns:



15
16
17
# File 'lib/types/places/location.rb', line 15

def geo
  @geo
end

#idString (readonly)

The id of the location.

Returns:

  • (String)


7
8
9
# File 'lib/types/places/location.rb', line 7

def id
  @id
end

#matchparamString (readonly)

The part of the queried placeid that this location matches.

Returns:

  • (String)


11
12
13
# File 'lib/types/places/location.rb', line 11

def matchparam
  @matchparam
end

#objectsArray<::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

#timechangesArray<::LibTAD::TADTime::TimeChange> (readonly)

Time changes (daylight savings time). Only present if requested and information is available.

Returns:



23
24
25
# File 'lib/types/places/location.rb', line 23

def timechanges
  @timechanges
end