Class: RedfishClient::Response
- Inherits:
-
Object
- Object
- RedfishClient::Response
- Defined in:
- lib/redfish_client/response.rb
Overview
Response struct.
This struct is returned from the methods that interact with the remote API.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
- #done? ⇒ Boolean
-
#initialize(status, headers, body) ⇒ Response
constructor
A new instance of Response.
- #monitor ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(status, headers, body) ⇒ Response
Returns a new instance of Response.
12 13 14 15 16 |
# File 'lib/redfish_client/response.rb', line 12 def initialize(status, headers, body) @status = status @headers = headers @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/redfish_client/response.rb', line 10 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/redfish_client/response.rb', line 9 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/redfish_client/response.rb', line 8 def status @status end |
Class Method Details
.from_hash(data) ⇒ Object
30 31 32 |
# File 'lib/redfish_client/response.rb', line 30 def self.from_hash(data) new(*data.values_at("status", "headers", "body")) end |
Instance Method Details
#done? ⇒ Boolean
18 19 20 |
# File 'lib/redfish_client/response.rb', line 18 def done? status != 202 end |
#monitor ⇒ Object
22 23 24 |
# File 'lib/redfish_client/response.rb', line 22 def monitor done? ? nil : headers["location"] end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/redfish_client/response.rb', line 26 def to_h { "status" => status, "headers" => headers, "body" => body } end |