Class: Geocoder::Result::Pelias

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

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#country, #initialize, #latitude, #longitude, #province_code

Constructor Details

This class inherits a constructor from Geocoder::Result::Base

Class Method Details

.response_attributesObject


37
38
39
# File 'lib/geocoder/results/pelias.rb', line 37

def self.response_attributes
  %w[county confidence country gid id layer localadmin locality neighborhood]
end

Instance Method Details

#address(format = :full) ⇒ Object


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

def address(format = :full)
  properties['label']
end

#cityObject


9
10
11
# File 'lib/geocoder/results/pelias.rb', line 9

def city
  locality
end

#coordinatesObject


13
14
15
# File 'lib/geocoder/results/pelias.rb', line 13

def coordinates
  geometry['coordinates'].reverse
end

#country_codeObject


17
18
19
# File 'lib/geocoder/results/pelias.rb', line 17

def country_code
  properties['country_a']
end

#postal_codeObject


21
22
23
# File 'lib/geocoder/results/pelias.rb', line 21

def postal_code
  properties['postalcode'].to_s
end

#provinceObject


25
26
27
# File 'lib/geocoder/results/pelias.rb', line 25

def province
  state
end

#stateObject


29
30
31
# File 'lib/geocoder/results/pelias.rb', line 29

def state
  properties['region']
end

#state_codeObject


33
34
35
# File 'lib/geocoder/results/pelias.rb', line 33

def state_code
  properties['region_a']
end