Sha256: 293a001bf0cac76f1e85f4995aa35991e9439282472331966777f3ca965da8b6
Contents?: true
Size: 848 Bytes
Versions: 3
Compression:
Stored size: 848 Bytes
Contents
# frozen_string_literal: true require "uri" module RedfishClient # Response struct. # # This struct is returned from the methods that interact with the remote API. class Response attr_reader :status attr_reader :headers attr_reader :body def initialize(status, headers, body) @status = status @headers = headers @body = body end def done? status != 202 end def monitor return nil if done? uri = URI.parse(headers["location"]) [uri.path, uri.query].compact.join("?") end def to_h { "status" => status, "headers" => headers, "body" => body } end def to_s "Response[status=#{status}, headers=#{headers}, body='#{body}']" end def self.from_hash(data) new(*data.values_at("status", "headers", "body")) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redfish_client-0.5.4 | lib/redfish_client/response.rb |
redfish_client-0.5.3 | lib/redfish_client/response.rb |
redfish_client-0.5.2 | lib/redfish_client/response.rb |