Class: Geocoder::Result::AmazonLocationService

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/results/amazon_location_service.rb

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Instance Method Summary collapse

Methods inherited from Base

#latitude, #longitude

Constructor Details

#initialize(result) ⇒ AmazonLocationService

Returns a new instance of AmazonLocationService.



5
6
7
8
# File 'lib/geocoder/results/amazon_location_service.rb', line 5

def initialize(result)
  @place = result.place
  super
end

Instance Method Details

#addressObject



14
15
16
# File 'lib/geocoder/results/amazon_location_service.rb', line 14

def address
  @place.label
end

#cityObject



26
27
28
# File 'lib/geocoder/results/amazon_location_service.rb', line 26

def city
  @place.municipality || @place.sub_region
end

#coordinatesObject



10
11
12
# File 'lib/geocoder/results/amazon_location_service.rb', line 10

def coordinates
  [@place.geometry.point[1], @place.geometry.point[0]]
end

#countryObject



50
51
52
# File 'lib/geocoder/results/amazon_location_service.rb', line 50

def country
  @place.country
end

#country_codeObject



54
55
56
# File 'lib/geocoder/results/amazon_location_service.rb', line 54

def country_code
  @place.country
end

#neighborhoodObject



18
19
20
# File 'lib/geocoder/results/amazon_location_service.rb', line 18

def neighborhood
  @place.neighborhood
end

#place_idObject



58
59
60
# File 'lib/geocoder/results/amazon_location_service.rb', line 58

def place_id
  data.place_id if data.respond_to?(:place_id)
end

#postal_codeObject



46
47
48
# File 'lib/geocoder/results/amazon_location_service.rb', line 46

def postal_code
  @place.postal_code
end

#provinceObject



38
39
40
# File 'lib/geocoder/results/amazon_location_service.rb', line 38

def province
  @place.region
end

#province_codeObject



42
43
44
# File 'lib/geocoder/results/amazon_location_service.rb', line 42

def province_code
  @place.region
end

#routeObject



22
23
24
# File 'lib/geocoder/results/amazon_location_service.rb', line 22

def route
  @place.street
end

#stateObject



30
31
32
# File 'lib/geocoder/results/amazon_location_service.rb', line 30

def state
  @place.region
end

#state_codeObject



34
35
36
# File 'lib/geocoder/results/amazon_location_service.rb', line 34

def state_code
  @place.region
end