Class: EchoCraft::Response
- Inherits:
-
Object
- Object
- EchoCraft::Response
- Defined in:
- lib/echo_craft/response.rb
Overview
Basic Response with EchoCraft Struct
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #change_status(status) ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
11 12 13 14 |
# File 'lib/echo_craft/response.rb', line 11 def initialize change_status(:processing) @data = ::OpenStruct.new end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/echo_craft/response.rb', line 9 def data @data end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/echo_craft/response.rb', line 9 def @message end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/echo_craft/response.rb', line 9 def status @status end |
Instance Method Details
#change_status(status) ⇒ Object
20 21 22 23 24 |
# File 'lib/echo_craft/response.rb', line 20 def change_status(status) @status = ::Rack::Utils.status_code(status) @message = ::Rack::Utils::HTTP_STATUS_CODES[@status] @status end |