class AWS::Core::Response

@private

def cache_key

def cache_key
  [http_request.access_key_id,
   http_request.host,
   request_type,
   serialized_options].join(":")
end

def initialize http_request = nil, http_response = nil, &block

Parameters:
  • http_request (Http::Response) --
  • http_request (Http::Request) --
def initialize http_request = nil, http_response = nil, &block
  @http_request = http_request
  @http_response = http_response
  @request_builder = block
  rebuild_request if @request_builder && !http_request
end

def inspect

Other tags:
    Private: -
def inspect
  if request_type
    "<#{self.class}:#{request_type}>"
  else
    "<#{self.class}>"
  end
end

def rebuild_request

Rebuilds the HTTP request using the block passed to the initializer
def rebuild_request
  @http_request = @request_builder.call
end

def serialize_options_array(ary)

def serialize_options_array(ary)
  "[" + ary.map { |v| serialize_options_value(v) }.join(" ") +
    "]"
end

def serialize_options_hash(hash)

def serialize_options_hash(hash)
  "(" + hash.keys.sort_by(&:to_s).map do |key|
    "#{key}=#{serialize_options_value(hash[key])}"
  end.join(" ") + ")"
end

def serialize_options_value(value)

def serialize_options_value(value)
  case value
  when Hash
    serialize_options_hash(value)
  when Array
    serialize_options_array(value)
  else
    value.inspect
  end
end

def serialized_options

def serialized_options
  serialize_options_hash(request_options)
end

def successful?

Returns:
  • (Boolean) - Returns true unless there is a response error.
def successful?
  error.nil?
end

def throttled?

Returns:
  • (Boolean) - Returns true if the http request was throttled
def throttled?
  !successful? and
    http_response.body and
    parsed_body = XmlGrammar.parse(http_response.body) and
    parsed_body.respond_to?(:code) and
    parsed_body.code == "Throttling"
end

def timeout?

Returns:
  • (Boolean) - Returns true if the http request timed out.
def timeout?
  http_response.timeout?
end