Class: Loginator::Response
- Inherits:
-
Struct
- Object
- Struct
- Loginator::Response
- Includes:
- JsonableStruct, Transaction
- Defined in:
- lib/loginator/response.rb
Overview
A Response is a response to a Request. It should include the same elements as a request, plus the status of the response (an indicator if the API request was successful or not) as well as an optional response body. Whether or not to log the response is entirely left up to implementation decisions and production log volume considerations. It is trivial to log response bodies in development, but not in production.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#path ⇒ Object
Returns the value of attribute path.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(request_id = uuid, timestamp = format_time, path = nil, status = 0, body = '') ⇒ Response
constructor
Create a new Loginator::Response.
Methods included from Transaction
Methods included from JsonableStruct
Constructor Details
#initialize(request_id = uuid, timestamp = format_time, path = nil, status = 0, body = '') ⇒ Response
Create a new Loginator::Response
23 24 25 |
# File 'lib/loginator/response.rb', line 23 def initialize(request_id = uuid, = format_time, path = nil, status = 0, body = '') super end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
13 14 15 |
# File 'lib/loginator/response.rb', line 13 def body @body end |
#path ⇒ Object
Returns the value of attribute path
13 14 15 |
# File 'lib/loginator/response.rb', line 13 def path @path end |
#request_id ⇒ Object
Returns the value of attribute request_id
13 14 15 |
# File 'lib/loginator/response.rb', line 13 def request_id @request_id end |
#status ⇒ Object
Returns the value of attribute status
13 14 15 |
# File 'lib/loginator/response.rb', line 13 def status @status end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
13 14 15 |
# File 'lib/loginator/response.rb', line 13 def @timestamp end |