class Geocoder::Lookup::Geoapify

def results(query)

def results(query)
  return [] unless (doc = fetch_data(query))
  # The rest of the status codes should be already handled by the default
  # functionality as the API returns correct HTTP response codes in most
  # cases. There may be some unhandled cases still (such as over query
  # limit reached) but there is not enough documentation to cover them.
  case doc['statusCode']
  when 500
    raise_error(Geocoder::InvalidRequest) || Geocoder.log(:warn, doc['message'])
  end
  return [] unless doc['type'] == 'FeatureCollection'
  return [] unless doc['features'] || doc['features'].present?
  doc['features']
end