class LibTAD::Places::Location

Information about a location.

Attributes

geo[R]

@return [Geo] Geographical information about the location.

id[R]

@return [String] The id of the location.

matchparam[R]

@return [String] The part of the queried placeid that this location matches.

objects[R]

@return [Array<::LibTAD::Astronomy::AstronomyObject>] Astronomical information – sunrise and sunset times. Only for the timeservice and if requested.

time[R]

@return [::LibTAD::TADTime::TADTime] Time information. Only present if requested.

timechanges[R]

@return [Array<::LibTAD::TADTime::TimeChange>] Time changes (daylight savings time). Only present if requested and information is available.

Public Class Methods

new(hash) click to toggle source
# 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