class Geocoder::Lookup::Yandex

def results(query)

def results(query)
  return [] unless doc = fetch_data(query)
  if err = doc['error']
    if err["status"] == 401 and err["message"] == "invalid key"
      raise_error(Geocoder::InvalidApiKey) || Geocoder.log(:warn, "Invalid API key.")
    else
      Geocoder.log(:warn, "Yandex Geocoding API error: #{err['status']} (#{err['message']}).")
    end
    return []
  end
  if doc = doc['response']['GeoObjectCollection']
    return doc['featureMember'].to_a
  else
    Geocoder.log(:warn, "Yandex Geocoding API error: unexpected response format.")
    return []
  end
end