class CoachClient::Response
A response from RESTful request to the CyberCoach service.
Attributes
code[R]
@return [Integer] the HTTP code
header[R]
@return [String] the HTTP headers
Public Class Methods
new(header, body, code)
click to toggle source
Creates a new response.
@param [String] header the headers of the HTTP response @param [String] body the body of the HTTP response @param [Integer] code the HTTP response code @return [CoachClient::Response]
# File lib/coach_client/response.rb, line 16 def initialize(header, body, code) @header = header @body = body @code = code end
Public Instance Methods
to_h()
click to toggle source
Returns the body as Ruby Hash.
@return [Hash]
# File lib/coach_client/response.rb, line 25 def to_h JSON.parse(@body, symbolize_names: true) end
to_s()
click to toggle source
Returns the body as String.
@return [String]
# File lib/coach_client/response.rb, line 32 def to_s @body.to_s end