diff --git a/README.rdoc b/README.rdoc index c8dbb6e90899abe7da927f92ba1d980eddcb0577..29a71661801c58fefaca0091d2dd1843239bd460 100644 --- a/README.rdoc +++ b/README.rdoc @@ -175,10 +175,7 @@ If anyone has a more elegant solution to this problem I am very interested in se == To-do List -* handle OVER_QUERY_LIMIT error - * raise exception? maybe only when address! or search! is called - * print warning? -* support DataMapper, Mongoid, etc +* support different ORMs (DataMapper, Mongoid, etc) * use completely separate "drivers" for different AR adapters? * seems reasonable since we're using very DB-specific features * also need to make sure 'mysql2' is supported diff --git a/lib/geocoder/lookup.rb b/lib/geocoder/lookup.rb index 443c5cc0d28339c725901bfcaa7ee61b49867819..5e5a771a03bae48a6061ddad05976d560cf77986 100644 --- a/lib/geocoder/lookup.rb +++ b/lib/geocoder/lookup.rb @@ -49,7 +49,11 @@ module Geocoder def parsed_response(query, reverse = false) if doc = fetch_data(query, reverse) doc = ActiveSupport::JSON.decode(doc) - doc && doc['status'] == "OK" ? doc : nil + if doc && doc['status'] == "OK" + return doc + elsif doc['status'] == "OVER_QUERY_LIMIT" + warn "Google Geocoder API error: quota exceeded." + end end end @@ -78,3 +82,4 @@ module Geocoder end end end +