Class: NewRelic::Agent::HTTPClients::AbstractResponse

Inherits:
Object
  • Object
show all
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!

Instance Method Summary collapse

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

Returns:

  • (Boolean)


46
47
48
# File 'lib/new_relic/agent/http_clients/abstract.rb', line 46

def has_status_code?
  !!status_code
end

#status_codeObject

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