class Geocoder::Lookup::Base

def fetch_raw_data(query)


The result might or might not be cached.
Fetch a raw geocoding result (JSON string).
#
def fetch_raw_data(query)
  key = cache_key(query)
  if cache and body = cache[key]
    @cache_hit = true
  else
    check_api_key_configuration!(query)
    response = make_api_request(query)
    check_response_for_errors!(response)
    body = response.body
    # apply the charset from the Content-Type header, if possible
    ct = response['content-type']
    if ct && ct['charset']
      charset = ct.split(';').select do |s|
        s['charset']
      end.first.to_s.split('=')
      if charset.length == 2
        body.force_encoding(charset.last) rescue ArgumentError
      end
    end
    if cache and valid_response?(response)
      cache[key] = body
    end
    @cache_hit = false
  end
  body
end