Class: Fleck::Client::Response
- Inherits:
-
Object
- Object
- Fleck::Client::Response
- Includes:
- Loggable
- Defined in:
- lib/fleck/client/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Response
constructor
A new instance of Response.
Methods included from Loggable
Constructor Details
#initialize(payload) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 |
# File 'lib/fleck/client/response.rb', line 7 def initialize(payload) @data = Oj.load(payload).to_hash_with_indifferent_access @status = @data["status"] @headers = @data["headers"] || {} @body = @data["body"] @errors = @data["errors"] || [] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/fleck/client/response.rb', line 6 def body @body end |
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/fleck/client/response.rb', line 6 def errors @errors end |
#headers ⇒ Object
Returns the value of attribute headers.
6 7 8 |
# File 'lib/fleck/client/response.rb', line 6 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/fleck/client/response.rb', line 6 def status @status end |