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
CurbResponse, ExconHTTPResponse, HTTPClientResponse, HTTPResponse, 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:
34 35 36 37 38 39 40 |
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 34 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
42 43 44 |
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 42 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
48 49 50 |
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 48 def status_code @status_code ||= get_status_code end |