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

Constructor Details

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

Instance Method Details

#addressObject



51
52
53
# File 'lib/geocoder/results/mapquest.rb', line 51

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

#cityObject



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

def city
  @data['adminArea5']
end

#coordinatesObject



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

def coordinates
  [latitude, longitude]
end

#countryObject



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

def country
  @data['adminArea1']
end

#country_codeObject



47
48
49
# File 'lib/geocoder/results/mapquest.rb', line 47

def country_code
  country
end

#countyObject



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

def county
  @data['adminArea4']
end

#latitudeObject



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

def latitude
  @data["latLng"]["lat"]
end

#longitudeObject



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

def longitude
  @data["latLng"]["lng"]
end

#postal_codeObject



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

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

#stateObject Also known as: state_code, province, province_code



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

def state
  @data['adminArea3']
end

#streetObject



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

def street
  @data['street']
end