Class: Useless::Doc::Core::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/useless/doc/core/response.rb

Overview

Documentation for an HTTP response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Response

Returns a new instance of Response.

Parameters:

  • attrs (Hash) (defaults to: {})

    corresponds to the class’s instance attributes.



26
27
28
29
30
31
# File 'lib/useless/doc/core/response.rb', line 26

def initialize(attrs = {})
  @code         = attrs[:code]
  @description  = attrs[:description]
  @headers      = attrs[:headers] || []
  @body         = attrs[:body]
end

Instance Attribute Details

#bodyBody

Returns the body of the response.

Returns:

  • (Body)

    the body of the response.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/useless/doc/core/response.rb', line 21

class Response
  attr_accessor :code, :description, :status, :headers, :body

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @code         = attrs[:code]
    @description  = attrs[:description]
    @headers      = attrs[:headers] || []
    @body         = attrs[:body]
  end
end

#codeInteger

Returns the HTTP status code of the response.

Returns:

  • (Integer)

    the HTTP status code of the response.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/useless/doc/core/response.rb', line 21

class Response
  attr_accessor :code, :description, :status, :headers, :body

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @code         = attrs[:code]
    @description  = attrs[:description]
    @headers      = attrs[:headers] || []
    @body         = attrs[:body]
  end
end

#descriptionString

Returns a description of the rationale for the response.

Returns:

  • (String)

    a description of the rationale for the response.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/useless/doc/core/response.rb', line 21

class Response
  attr_accessor :code, :description, :status, :headers, :body

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @code         = attrs[:code]
    @description  = attrs[:description]
    @headers      = attrs[:headers] || []
    @body         = attrs[:body]
  end
end

#headersArray<Header>

Returns the significant headers of the response.

Returns:

  • (Array<Header>)

    the significant headers of the response.

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/useless/doc/core/response.rb', line 21

class Response
  attr_accessor :code, :description, :status, :headers, :body

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs = {})
    @code         = attrs[:code]
    @description  = attrs[:description]
    @headers      = attrs[:headers] || []
    @body         = attrs[:body]
  end
end

#statusObject

Returns the value of attribute status.



22
23
24
# File 'lib/useless/doc/core/response.rb', line 22

def status
  @status
end