class NewRelic::Agent::HTTPClients::ExconHTTPResponse
Public Class Methods
new(wrapped_response)
click to toggle source
Calls superclass method
# File lib/new_relic/agent/http_clients/excon_wrappers.rb, line 11 def initialize(wrapped_response) super(wrapped_response) # Since HTTP headers are case-insensitive, we normalize all of them to # upper case here, and then also in our [](key) implementation. @normalized_headers = {} (get_attribute(:headers) || {}).each do |key, val| @normalized_headers[key.upcase] = val end end
Public Instance Methods
[](key)
click to toggle source
# File lib/new_relic/agent/http_clients/excon_wrappers.rb, line 22 def [](key) @normalized_headers[key.upcase] end
to_hash()
click to toggle source
# File lib/new_relic/agent/http_clients/excon_wrappers.rb, line 26 def to_hash @normalized_headers.dup end
Private Instance Methods
get_attribute(name)
click to toggle source
# File lib/new_relic/agent/http_clients/excon_wrappers.rb, line 32 def get_attribute(name) if @wrapped_response.respond_to?(name) @wrapped_response.send(name) else @wrapped_response[name] end end
get_status_code()
click to toggle source
# File lib/new_relic/agent/http_clients/excon_wrappers.rb, line 40 def get_status_code code = get_attribute(:status).to_i code == 0 ? nil : code end