Class: Geocoder::Result::Mapquest

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

Instance Attribute Summary

Attributes inherited from Base

#cache_hit, #data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latitude, #longitude

Constructor Details

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

Instance Method Details

#addressObject



44
45
46
# File 'lib/geocoder/results/mapquest.rb', line 44

def address
  [street, city, state, postal_code, country].reject{|s| s.length == 0 }.join(", ")
end

#cityObject



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

def city
  @data['adminArea5']
end

#coordinatesObject



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

def coordinates
  %w[lat lng].map{ |l| @data["latLng"][l] }
end

#countryObject



36
37
38
# File 'lib/geocoder/results/mapquest.rb', line 36

def country
  @data['adminArea1']
end

#country_codeObject



40
41
42
# File 'lib/geocoder/results/mapquest.rb', line 40

def country_code
  country
end

#countyObject



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

def county
  @data['adminArea4']
end

#postal_codeObject



32
33
34
# File 'lib/geocoder/results/mapquest.rb', line 32

def postal_code
  @data['postalCode'].to_s
end

#stateObject Also known as: state_code, province, province_code



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

def state
  @data['adminArea3']
end

#streetObject



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

def street
  @data['street']
end