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 38 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 13 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 19 def done? status != 202 end
monitor()
click to toggle source
# File lib/redfish_client/response.rb, line 23 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 30 def to_h { "status" => status, "headers" => headers, "body" => body } end
to_s()
click to toggle source
# File lib/redfish_client/response.rb, line 34 def to_s "Response[status=#{status}, headers=#{headers}, body='#{body}']" end