Class: Graticule::Geocoder::Yahoo
- Defined in:
- lib/graticule/geocoder/yahoo.rb
Overview
Yahoo geocoding API.
Defined Under Namespace
Classes: Address, Error, Result
Constant Summary collapse
- PRECISION =
{ "country" => Precision::Country, "state" => Precision::Region, "city" => Precision::Locality, "zip+4" => Precision::PostalCode, "zip+2" => Precision::PostalCode, "zip" => Precision::PostalCode, "street" => Precision::Street, "address" => Precision::Address }
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(appid) ⇒ Yahoo
constructor
Web services initializer.
-
#locate(address) ⇒ Object
Returns a Location for
address
.
Constructor Details
#initialize(appid) ⇒ Yahoo
Web services initializer.
The appid
is the Application ID that uniquely identifies your application. See: developer.yahoo.com/faq/index.html#appid
27 28 29 30 |
# File 'lib/graticule/geocoder/yahoo.rb', line 27 def initialize(appid) @appid = appid @url = URI.parse "http://api.local.yahoo.com/MapsService/V1/geocode" end |
Instance Method Details
#locate(address) ⇒ Object
Returns a Location for address
.
The address
can be any of:
-
city, state
-
city, state, zip
-
zip
-
street, city, state
-
street, city, state, zip
-
street, zip
41 42 43 44 45 |
# File 'lib/graticule/geocoder/yahoo.rb', line 41 def locate(address) location = (address.is_a?(String) ? address : location_from_params(address).to_s(:country => false)) # yahoo pukes on line breaks get :location => location.gsub("\n", ', ') end |