Class: Zenrows::Backends::NetHttpResponse Private
- Inherits:
-
Object
- Object
- Zenrows::Backends::NetHttpResponse
- Defined in:
- lib/zenrows/backends/net_http.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Response wrapper that mimics http.rb response interface
Instance Attribute Summary collapse
-
#raw ⇒ Net::HTTPResponse
readonly
private
Raw response.
Instance Method Summary collapse
-
#body ⇒ String
private
Response body.
-
#headers ⇒ Hash
private
Response headers.
-
#initialize(response) ⇒ NetHttpResponse
constructor
private
A new instance of NetHttpResponse.
-
#status ⇒ Integer
private
HTTP status code.
-
#to_s ⇒ Object
private
Alias for body (http.rb compatibility).
Constructor Details
#initialize(response) ⇒ NetHttpResponse
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NetHttpResponse.
124 125 126 |
# File 'lib/zenrows/backends/net_http.rb', line 124 def initialize(response) @raw = response end |
Instance Attribute Details
#raw ⇒ Net::HTTPResponse (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Raw response.
122 123 124 |
# File 'lib/zenrows/backends/net_http.rb', line 122 def raw @raw end |
Instance Method Details
#body ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Response body.
129 130 131 |
# File 'lib/zenrows/backends/net_http.rb', line 129 def body @raw.body end |
#headers ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Response headers.
139 140 141 |
# File 'lib/zenrows/backends/net_http.rb', line 139 def headers @raw.to_hash.transform_values(&:first) end |
#status ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns HTTP status code.
134 135 136 |
# File 'lib/zenrows/backends/net_http.rb', line 134 def status @raw.code.to_i end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Alias for body (http.rb compatibility)
144 145 146 |
# File 'lib/zenrows/backends/net_http.rb', line 144 def to_s body end |