alexreisner/geocoder — pull request #661 by rob-murray (2014-06-05 16:18:47+00:00)
Title: Add lookup fallback

Hi,
I have add a fallback configuration and have been using it in a Rails app - I was wondering if you thought the changes were suitable for your version of the gem? It kindof fulfils one part of #351 and maybe could do with being a bit more flexible to satisfy the other requests of that issue. I may have potentially missed some impact that I have not considered yet so either way I would like your feedback so I know if i will run into any problems!

So, this allows you to configure a 'fallback' lookup service on a specified Error. An example use could be to use a primary API by default but fallback to a secondary service if the primary returns an "over usage" limit error so that you always get a response.

### Default behaviour

By default Geocoder will simply use the specified (either configured or default) lookup and the behaviour is as before.

### With a fallback

When a fallback is configured, the Query is performed on the primary service/lookup and if successful then the results are returned, however if this lookup happens to raise the Error that is specified then the same query will be performed on the secondary lookup and results returned from this. If this fails then the behaviour is as before, the error is either raised or ignored, depending on configuration.

Configured can be set like this;

```ruby
# config/initializers/geocoder.rb
Geocoder.configure(

# geocoding service (see below for supported options):
:lookup => :yandex,

# fallback to another provider on specific error
:lookup_fallback => {
:to => :google,
:on => Geocoder::OverQueryLimitError
})
```

One improvement may be to allow an array of errors to 'fallback' on, for example `TimeoutError` and `OverQueryLimitError` but I don't need this at the moment.

Apologies for updating the `VERSION` and `CHANGELOG` but I needed to identify the gem version and changes from my fork - as I mentioned I have been using it along with another couple of lookups, without changing the version it got a bit confusing!