Class: NewRelic::Agent::HTTPClients::AbstractResponse
- Inherits:
-
Object
- Object
- NewRelic::Agent::HTTPClients::AbstractResponse
- Defined in:
- lib/new_relic/agent/http_clients/abstract.rb
Overview
This class implements the adaptor pattern and is used internally provide uniform access to the underlying HTTP Client’s response object NOTE: response_object should be non-nil!
Direct Known Subclasses
AsyncHTTPResponse, CurbResponse, EthonHTTPResponse, ExconHTTPResponse, HTTPClientResponse, HTTPResponse, HTTPXHTTPResponse, NetHTTPResponse, TyphoeusHTTPResponse
Instance Method Summary collapse
- #has_status_code? ⇒ Boolean
-
#initialize(wrapped_response) ⇒ AbstractResponse
constructor
:nodoc:.
-
#status_code ⇒ Object
most HTTP client libraries report the HTTP status code as an integer, so we expect status_code to be set only if a non-zero value is present.
Constructor Details
#initialize(wrapped_response) ⇒ AbstractResponse
:nodoc:
38 39 40 41 42 43 44 |
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 38 def initialize(wrapped_response) if wrapped_response.nil? raise ArgumentError, WHINY_NIL_ERROR % self.class end @wrapped_response = wrapped_response end |
Instance Method Details
#has_status_code? ⇒ Boolean
46 47 48 |
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 46 def has_status_code? !!status_code end |
#status_code ⇒ Object
most HTTP client libraries report the HTTP status code as an integer, so we expect status_code to be set only if a non-zero value is present
52 53 54 |
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 52 def status_code @status_code ||= get_status_code end |