lib/contentful/client.rb
def get(request, build_resource = true)
      retries_left = configuration[:max_rate_limit_retries]
      result = nil
      begin
        response = run_request(request)

        return response if !build_resource || configuration[:raw_mode]

        return fail_response(response) if response.status != :ok

        result = do_build_resource(response)
      rescue UnparsableResource => error
        raise error if configuration[:raise_errors]
        return error
      rescue Contentful::RateLimitExceeded => rate_limit_error
        reset_time = rate_limit_error.reset_time.to_i
        if should_retry(retries_left, reset_time, configuration[:max_rate_limit_wait])
          retries_left -= 1
          logger.info(retry_message(retries_left, reset_time)) if logger
          sleep(reset_time * Random.new.rand(1.0..1.2))
          retry
        end

        raise
      end

      result
    end
def get(request, build_resource = true)
      retries_left = configuration[:max_rate_limit_retries]
      result = nil
      begin
        response = run_request(request)

        return response if !build_resource || configuration[:raw_mode]

        return fail_response(response) if response.status != :ok

        result = do_build_resource(response)
      rescue UnparsableResource => error
        raise error if configuration[:raise_errors]
        return error
      rescue Contentful::RateLimitExceeded => rate_limit_error
        reset_time = rate_limit_error.reset_time.to_i
        if should_retry(retries_left, reset_time, configuration[:max_rate_limit_wait])
          retries_left -= 1
          logger.info(retry_message(retries_left, reset_time)) if logger
          sleep(reset_time * Random.new.rand(1.0..1.2))
          retry
        end

        raise
      end

      result
    end
def get ( request , build_resource = true ) retries_left = configuration [ :max_rate_limit_retries ] result = nil begin response = run_request ( request ) return response if ! build_resource || configuration [ :raw_mode ] return fail_response ( response ) if response . status != :ok result = do_build_resource ( response ) rescue UnparsableResource => error raise error if configuration [ :raise_errors ] return error rescue Contentful :: RateLimitExceeded => rate_limit_error reset_time = rate_limit_error . reset_time . to_i if should_retry ( retries_left , reset_time , configuration [ :max_rate_limit_wait ] ) retries_left -= 1 logger . info ( retry_message ( retries_left , reset_time ) ) if logger sleep ( reset_time * Random . new . rand ( 1.0 .. 1.2 ) ) retry end raise end result end
Get a Contentful::Request object
 Set second parameter to false to deactivate Resource building and
 return Response objects instead

 @private
Get a Contentful :: Request object Set second parameter to false to deactivate Resource building and return Response objects instead