class Geocoder::Lookup::Google

def map_link_url(coordinates)

def map_link_url(coordinates)
  "http://maps.google.com/maps?q=#{coordinates.join(',')}"
end

def query_url(query, reverse = false)

def query_url(query, reverse = false)
  params = {
    (reverse ? :latlng : :address) => query,
    :sensor => "false",
    :language => Geocoder::Configuration.language,
    :key => Geocoder::Configuration.api_key
  }
  "#{protocol}://maps.googleapis.com/maps/api/geocode/json?" + hash_to_query(params)
end

def results(query, reverse = false)

def results(query, reverse = false)
  return [] unless doc = fetch_data(query, reverse)
  case doc['status']; when "OK" # OK status implies >0 results
    return doc['results']
  when "OVER_QUERY_LIMIT"
    warn "Google Geocoding API error: over query limit."
  when "REQUEST_DENIED"
    warn "Google Geocoding API error: request denied."
  when "INVALID_REQUEST"
    warn "Google Geocoding API error: invalid request."
  end
  return []
end