Class: Useless::Doc::Core::Response
- Inherits:
-
Object
- Object
- Useless::Doc::Core::Response
- Defined in:
- lib/useless/doc/core/response.rb
Overview
Documentation for an HTTP response.
Instance Attribute Summary collapse
-
#body ⇒ Body
The body of the response.
-
#code ⇒ Integer
The HTTP status code of the response.
-
#description ⇒ String
A description of the rationale for the response.
-
#headers ⇒ Array<Header>
The significant headers of the response.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(attrs = {}) ⇒ Response
Returns a new instance of Response.
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
#body ⇒ Body
Returns 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 |
#code ⇒ Integer
Returns 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 |
#description ⇒ String
Returns 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 |
#headers ⇒ Array<Header>
Returns the significant headers 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 |
#status ⇒ Object
Returns the value of attribute status.
22 23 24 |
# File 'lib/useless/doc/core/response.rb', line 22 def status @status end |