Class: NewRelic::Agent::HTTPClients::HTTPClientResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/http_clients/httpclient_wrappers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HTTPClientResponse

Returns a new instance of HTTPClientResponse.



11
12
13
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 11

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 9

def response
  @response
end

Instance Method Details

#[](key) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 15

def [](key)
  response.headers.each do |k,v|
    if key.downcase == k.downcase
      return v
    end
  end
  nil
end

#to_hashObject



24
25
26
# File 'lib/new_relic/agent/http_clients/httpclient_wrappers.rb', line 24

def to_hash
  response.headers
end