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.
116 117 118 |
# File 'lib/zenrows/backends/net_http.rb', line 116 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.
114 115 116 |
# File 'lib/zenrows/backends/net_http.rb', line 114 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.
121 122 123 |
# File 'lib/zenrows/backends/net_http.rb', line 121 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.
131 132 133 |
# File 'lib/zenrows/backends/net_http.rb', line 131 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.
126 127 128 |
# File 'lib/zenrows/backends/net_http.rb', line 126 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)
136 137 138 |
# File 'lib/zenrows/backends/net_http.rb', line 136 def to_s body end |