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

#address ⇒ Object



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

def address
  @place.label
end

#city ⇒ Object



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

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

#coordinates ⇒ Object



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

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

#country ⇒ Object



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

def country
  @place.country
end

#country_code ⇒ Object



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

def country_code
  @place.country
end

#neighborhood ⇒ Object



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

def neighborhood
  @place.neighborhood
end

#place_id ⇒ Object



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_code ⇒ Object



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

def postal_code
  @place.postal_code
end

#province ⇒ Object



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

def province
  @place.region
end

#province_code ⇒ Object



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

def province_code
  @place.region
end

#route ⇒ Object



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

def route
  @place.street
end

#state ⇒ Object



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

def state
  @place.region
end

#state_code ⇒ Object



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

def state_code
  @place.region
end