Class: Puppet::Rest::Response
Overview
This is a wrapper for the HTTP::Message class of the HTTPClient gem. It is designed to wrap a message sent as an HTTP response.
Instance Method Summary collapse
- #body ⇒ Object
- #content_encoding ⇒ Object
- #content_type ⇒ Object
-
#initialize(message) ⇒ Response
constructor
A new instance of Response.
- #ok? ⇒ Boolean
- #status_code ⇒ Object
- #to_exception ⇒ Object
Constructor Details
#initialize(message) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/puppet/rest/response.rb', line 6 def initialize() = end |
Instance Method Details
#body ⇒ Object
10 11 12 |
# File 'lib/puppet/rest/response.rb', line 10 def body .body end |
#content_encoding ⇒ Object
18 19 20 |
# File 'lib/puppet/rest/response.rb', line 18 def content_encoding .headers['Content-Encoding'] end |
#content_type ⇒ Object
14 15 16 |
# File 'lib/puppet/rest/response.rb', line 14 def content_type .content_type end |
#ok? ⇒ Boolean
26 27 28 |
# File 'lib/puppet/rest/response.rb', line 26 def ok? .ok? end |
#status_code ⇒ Object
22 23 24 |
# File 'lib/puppet/rest/response.rb', line 22 def status_code .status end |
#to_exception ⇒ Object
30 31 32 33 |
# File 'lib/puppet/rest/response.rb', line 30 def to_exception = _("Error %{code} on SERVER: %{returned_message}") % { code: status_code, returned_message: body } Puppet::Rest::ResponseError.new(, self) end |