Class: RightScale::CloudApi::HTTPParent
- Defined in:
- lib/base/helpers/http_parent.rb
Overview
The parent class for HTTPRequest and HTTPResponse.
The class defines generic methods that are used by both Request and Response classes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ String?
Returns the response body.
-
#raw ⇒ Net::HTTPResponse
Returns Net::HTTPResponse object.
Instance Method Summary collapse
-
#[](header) ⇒ Array
Retrieves the given header values.
-
#headers ⇒ Hash
Returns all the headers for the current request/response instance.
-
#headers_info ⇒ String
Displays the current headers in a nice way.
-
#is_io? ⇒ Boolean
Returns true if the current object’s body is an IO instance.
Instance Attribute Details
#body ⇒ String?
Returns the response body
50 51 52 |
# File 'lib/base/helpers/http_parent.rb', line 50 def body @body end |
#raw ⇒ Net::HTTPResponse
Returns Net::HTTPResponse object
41 42 43 |
# File 'lib/base/helpers/http_parent.rb', line 41 def raw @raw end |
Instance Method Details
#[](header) ⇒ Array
Retrieves the given header values
72 73 74 |
# File 'lib/base/helpers/http_parent.rb', line 72 def [](header) @headers[header] end |
#headers ⇒ Hash
Returns all the headers for the current request/response instance
59 60 61 |
# File 'lib/base/helpers/http_parent.rb', line 59 def headers @headers.to_hash end |
#headers_info ⇒ String
Displays the current headers in a nice way
97 98 99 |
# File 'lib/base/helpers/http_parent.rb', line 97 def headers_info @headers.to_s end |
#is_io? ⇒ Boolean
Returns true if the current object’s body is an IO instance
84 85 86 |
# File 'lib/base/helpers/http_parent.rb', line 84 def is_io? body.is_a?(IO) || body.is_a?(Net::ReadAdapter) end |