class Geocoder::Lookup::Google
def results(query)
def results(query) return [] unless doc = fetch_data(query) case doc['status'] when "OK" # OK status implies >0 results return doc[result_root_attr] when "OVER_QUERY_LIMIT" raise_error(Geocoder::OverQueryLimitError) || Geocoder.log(:warn, "#{name} API error: over query limit.") when "REQUEST_DENIED" raise_error(Geocoder::RequestDenied, doc['error_message']) || Geocoder.log(:warn, "#{name} API error: request denied (#{doc['error_message']}).") when "INVALID_REQUEST" raise_error(Geocoder::InvalidRequest, doc['error_message']) || Geocoder.log(:warn, "#{name} API error: invalid request (#{doc['error_message']}).") end return [] end