Class: StatsCloud::ParsedResponseHelper

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ParsedResponseHelper

Creates new helper object with parsed response body as json.

Parameters:

  • response (+RestClient::Response+)

    response from the cluster.



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

#bodyObject (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

#codeObject (readonly)

RestClient response code.

Type: Integer



16
17
18
# File 'lib/statscloud/helpers/parsed_response_helper.rb', line 16

def code
  @code
end