Class: Localeui::Response
- Inherits:
-
Object
- Object
- Localeui::Response
- Includes:
- StatusCodes
- Defined in:
- lib/localeui/response.rb,
lib/localeui/response/status_codes.rb
Defined Under Namespace
Modules: StatusCodes
Constant Summary
Constants included from StatusCodes
StatusCodes::HTTP_BAD_REQUEST_CODE, StatusCodes::HTTP_CREATED_CODE, StatusCodes::HTTP_FORBIDDEN_CODE, StatusCodes::HTTP_NOT_FOUND_CODE, StatusCodes::HTTP_OK_CODE, StatusCodes::HTTP_UNAUTHORIZED_CODE, StatusCodes::HTTP_UNPROCESSABLE_ENTITY_CODE
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(request, response) ⇒ Response
constructor
A new instance of Response.
- #successful? ⇒ Boolean
Constructor Details
#initialize(request, response) ⇒ Response
Returns a new instance of Response.
11 12 13 14 15 16 17 |
# File 'lib/localeui/response.rb', line 11 def initialize(request, response) @request = request @response = response init_header init_body identifiy_errors end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/localeui/response.rb', line 9 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/localeui/response.rb', line 9 def headers @headers end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
9 10 11 |
# File 'lib/localeui/response.rb', line 9 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/localeui/response.rb', line 9 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9 10 11 |
# File 'lib/localeui/response.rb', line 9 def status @status end |
Instance Method Details
#successful? ⇒ Boolean
19 20 21 |
# File 'lib/localeui/response.rb', line 19 def successful? [HTTP_OK_CODE, HTTP_CREATED_CODE].include?(@status) end |