class Seahorse::Client::Response

def initialize(options = {})

Options Hash: (**options)
  • :body (String) --
  • :headers (Http::Headers) --
  • :status_code (Integer) --
  • :context (RequestContext) --
def initialize(options = {})
  @context = options[:context] || RequestContext.new
  @data = options[:data]
  @error = options[:error]
  @http_request = @context.http_request
  @http_response = @context.http_response
end

def inspect

Other tags:
    Api: - private
def inspect
  if @data
    @data.respond_to?(:pretty_inspect) ? @data.pretty_inspect : super
  else
    super
  end
end

def method_missing(*args, &block)

def method_missing(*args, &block)
  if @data.respond_to?(args.first, false)
    @data.send(*args, &block)
  else
    super
  end
end

def on(status_code_range, &block)

Returns:
  • (self) -

Parameters:
  • status_code_range (Integer, Range) -- The block will be
def on(status_code_range, &block)
  range = status_code_range
  range = range..range if range.is_a?(Integer)
  yield(self) if range.include?(status_code)
  self
end

def on_success(&block)

Returns:
  • (self) -
def on_success(&block)
  on(200..299, &block)
end

def respond_to?(*args)

Other tags:
    Api: - private
def respond_to?(*args)
  @data.respond_to?(args.first, false) || super
end

def status_code

def status_code
  @http_response.status_code
end

def successful?

Parameters:
  • Returns (Boolean) -- `true` if the http response status
def successful?
  (200..299).include?(status_code)
end