Class: NewRelicHTTP::HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/newrelic_httprb/wrappers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HTTPResponse

Returns a new instance of HTTPResponse.



5
6
7
# File 'lib/newrelic_httprb/wrappers.rb', line 5

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/newrelic_httprb/wrappers.rb', line 3

def response
  @response
end

Instance Method Details

#[](key) ⇒ Object



9
10
11
12
# File 'lib/newrelic_httprb/wrappers.rb', line 9

def [](key)
  _, value = response.headers.find { |k,_| key.downcase == k.downcase }
  value unless value.nil?
end

#to_hashObject



14
15
16
# File 'lib/newrelic_httprb/wrappers.rb', line 14

def to_hash
  response.headers
end