Class: LibTAD::Places::Geo

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

Overview

Geographical information about a location.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Geo

Returns a new instance of Geo.



25
26
27
28
29
30
31
# File 'lib/types/places/geo.rb', line 25

def initialize(hash)
  @name = hash.fetch('name', nil)
  @state = hash.fetch('state', nil)
  @country = Country.new hash['country'] unless !hash.key?('country')
  @latitude = hash.fetch('latitude', nil)
  @longitude = hash.fetch('longitude', nil)
end

Instance Attribute Details

#countryCountry (readonly)

Country of the location.

Returns:



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

def country
  @country
end

#latitudeFloat (readonly)

Geographical latitude of the location.

Returns:

  • (Float)


19
20
21
# File 'lib/types/places/geo.rb', line 19

def latitude
  @latitude
end

#longitudeFloat (readonly)

Geographical longitude of the location.

Returns:

  • (Float)


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

def longitude
  @longitude
end

#nameString (readonly)

The name of the location.

Returns:

  • (String)


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

def name
  @name
end

#stateString (readonly)

The state of the location within the country (only if applicable).

Returns:

  • (String)


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

def state
  @state
end