Class: StatsCloud::ParsedResponseHelper
- Inherits:
-
Object
- Object
- StatsCloud::ParsedResponseHelper
- Includes:
- JsonParser
- Defined in:
- lib/statscloud/helpers/cluster_client/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.
Methods included from JsonParser
#convert_to_pretty_json, #parse_json
Constructor Details
#initialize(response) ⇒ ParsedResponseHelper
Creates new helper object with parsed response body as json.
23 24 25 26 |
# File 'lib/statscloud/helpers/cluster_client/parsed_response_helper.rb', line 23 def initialize(response) @code = response&.code @body = parse_json(response.body, nil) end |
Instance Attribute Details
#body ⇒ Object (readonly)
RestClient json-parsed response body.
Type: Hash
12 13 14 |
# File 'lib/statscloud/helpers/cluster_client/parsed_response_helper.rb', line 12 def body @body end |
#code ⇒ Object (readonly)
RestClient response code.
Type: Integer
17 18 19 |
# File 'lib/statscloud/helpers/cluster_client/parsed_response_helper.rb', line 17 def code @code end |