class RedfishClient::Response

Response struct.

This struct is returned from the methods that interact with the remote API.

Attributes

body[R]
headers[R]
status[R]

Public Class Methods

from_hash(data) click to toggle source
# File lib/redfish_client/response.rb, line 39
def self.from_hash(data)
  new(*data.values_at("status", "headers", "body"))
end
new(status, headers, body) click to toggle source
# File lib/redfish_client/response.rb, line 14
def initialize(status, headers, body)
  @status = status
  @headers = headers
  @body = body
end

Public Instance Methods

done?() click to toggle source
# File lib/redfish_client/response.rb, line 20
def done?
  status != 202
end
monitor() click to toggle source
# File lib/redfish_client/response.rb, line 24
def monitor
  return nil if done?

  uri = URI.parse(headers["location"])
  [uri.path, uri.query].compact.join("?")
end
to_h() click to toggle source
# File lib/redfish_client/response.rb, line 31
def to_h
  { "status" => status, "headers" => headers, "body" => body }
end
to_s() click to toggle source
# File lib/redfish_client/response.rb, line 35
def to_s
  "Response[status=#{status}, headers=#{headers}, body='#{body}']"
end