Class: StatsCloud::ParsedResponseHelper
- Inherits:
-
Object
- Object
- StatsCloud::ParsedResponseHelper
- Defined in:
- lib/statscloud/helpers/parsed_response_helper.rb
Overview
This helper works to parse response from the server to convenient object.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
RestClient json-parsed response body.
-
#code ⇒ Object
readonly
RestClient response code.
Instance Method Summary collapse
-
#initialize(response) ⇒ ParsedResponseHelper
constructor
Creates new helper object with parsed response body as json.
Constructor Details
#initialize(response) ⇒ ParsedResponseHelper
Creates new helper object with parsed response body as json.
22 23 24 25 |
# File 'lib/statscloud/helpers/parsed_response_helper.rb', line 22 def initialize(response) @code = response&.code @body = parse_json(response.body) end |
Instance Attribute Details
#body ⇒ Object (readonly)
RestClient json-parsed response body.
Type: Hash
11 12 13 |
# File 'lib/statscloud/helpers/parsed_response_helper.rb', line 11 def body @body end |
#code ⇒ Object (readonly)
RestClient response code.
Type: Integer
16 17 18 |
# File 'lib/statscloud/helpers/parsed_response_helper.rb', line 16 def code @code end |