Class: Memoir::Response
- Inherits:
-
Object
- Object
- Memoir::Response
- Defined in:
- lib/memoir/response.rb
Constant Summary collapse
- STATUS_OK =
200
Instance Attribute Summary collapse
-
#data_sets ⇒ Object
Returns the value of attribute data_sets.
-
#error ⇒ Object
Returns the value of attribute error.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#stats_summary ⇒ Object
Returns the value of attribute stats_summary.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(faraday_response) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/memoir/response.rb', line 6 def initialize(faraday_response) @data_sets = [] @status = faraday_response.status @raw = faraday_response.body if status == STATUS_OK parse_response(raw) else @error = Memoir::Error.new(raw['error']) end end |
Instance Attribute Details
#data_sets ⇒ Object
Returns the value of attribute data_sets.
2 3 4 |
# File 'lib/memoir/response.rb', line 2 def data_sets @data_sets end |
#error ⇒ Object
Returns the value of attribute error.
2 3 4 |
# File 'lib/memoir/response.rb', line 2 def error @error end |
#raw ⇒ Object
Returns the value of attribute raw.
2 3 4 |
# File 'lib/memoir/response.rb', line 2 def raw @raw end |
#stats_summary ⇒ Object
Returns the value of attribute stats_summary.
2 3 4 |
# File 'lib/memoir/response.rb', line 2 def stats_summary @stats_summary end |
#status ⇒ Object
Returns the value of attribute status.
2 3 4 |
# File 'lib/memoir/response.rb', line 2 def status @status end |