alexreisner/geocoder — pull request #315 by jedschneider (2012-10-16 15:27:30+00:00)
Title: Changes to the Mapquest Service; includes support for the premium service

We have a client that has recently switched to Mapquest's paid service and were using Geocoder before that. On the transition it was evident that the Mapquest support in Geocoder was pretty minimal and _maybe_ outdated. The Geocoder service url that was being requested was just proxyed through to the Nominatim service, even though Mapquest does support an open service.

This pull request changes the following:

- **refactored subclass**: The Mapquest service is no longer a subclass of the Nominatim service, it extends the `lookup` and `result` base classes directly. this choice was made as it became apparent that the response data structure and key values were distinct enough that mucking with the existing subclass would have just been pure hackery.
- **uses actual Mapquest API**: As a consequence of using the supported, and official API (currently v1) there are changes in the base data that is returned from the service. Where Nominatim, for example, might return "New York" for the state, Mapquest only returns "NY". All the base methods that the tests suggest need to be implemented for a subclass of the result base class have been implemented; but the returns may be slightly different than current Geocoder users using the Mapquest service might expect. Thus it might be reasonable to semantically indicate this with a version bump if this request is merged.
- **extended configuration hooks**: The Readme has been updated to indicate the configuration hooks that this pull request supports, namely the addition of `api_key` support for the paid tier of their service, and a note about `http_headers` configuration that is required to get data back while using the api key.

We are currently using the changes in a Rails 3 app with good results and seemingly faster lookups, but I have not benchmarked them.