Skip to content
Snippets Groups Projects
Commit d4c40aee authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #486 from robdiciuccio/mapquest

API key required for MapQuest Open services.

As of 15 July 2013. See: http://developer.mapquest.com/web/products/open/forums/-/message_boards/view_message/459709
parents bb2d338a d521c841
No related branches found
No related tags found
No related merge requests found
......@@ -374,7 +374,7 @@ Yahoo BOSS is **not a free service**. As of November 17, 2012 Yahoo no longer of
#### Mapquest (`:mapquest`)
* **API key**: required for the licensed API, do not use for open tier
* **API key**: required
* **Quota**: ?
* **HTTP Headers**: in order to use the licensed API you can configure the http_headers to include a referer as so:
`Geocoder.configure(:http_headers => { "Referer" => "http://foo.com" })`
......@@ -385,6 +385,7 @@ Yahoo BOSS is **not a free service**. As of November 17, 2012 Yahoo no longer of
* **Documentation**: http://www.mapquestapi.com/geocoding/
* **Terms of Service**: http://info.mapquest.com/terms-of-use/
* **Limitations**: ?
* **Notes**: You can specify the licensed API by setting: `Geocoder.configure(:mapquest => {:licensed => true})` (defaults to free "open" version)
#### Ovi/Nokia (`:ovi`)
......
......@@ -10,12 +10,11 @@ module Geocoder::Lookup
end
def required_api_key_parts
[]
["key"]
end
def query_url(query)
key = configuration.api_key
domain = key ? "www" : "open"
domain = configuration[:licensed] ? "www" : "open"
url = "#{protocol}://#{domain}.mapquestapi.com/geocoding/v1/#{search_type(query)}?"
url + url_query_string(query)
end
......
......@@ -276,6 +276,15 @@ class ServicesTest < Test::Unit::TestCase
lookup = Geocoder::Lookup::Mapquest.new
query = Geocoder::Query.new("Bluffton, SC")
res = lookup.query_url(query)
assert_equal "http://open.mapquestapi.com/geocoding/v1/address?key=abc123&location=Bluffton%2C+SC",
res
end
def test_api_route_licensed
Geocoder.configure(:lookup => :mapquest, :api_key => "abc123", :mapquest => {:licensed => true})
lookup = Geocoder::Lookup::Mapquest.new
query = Geocoder::Query.new("Bluffton, SC")
res = lookup.query_url(query)
assert_equal "http://www.mapquestapi.com/geocoding/v1/address?key=abc123&location=Bluffton%2C+SC",
res
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment