Class: NewRelic::Agent::HTTPClients::ExconHTTPRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(datum) ⇒ ExconHTTPRequest

Returns a new instance of ExconHTTPRequest.



30
31
32
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 30

def initialize(datum)
  @datum = datum
end

Instance Method Details

#[](key) ⇒ Object



50
51
52
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 50

def [](key)
  @datum[:headers][key]
end

#[]=(key, value) ⇒ Object



54
55
56
57
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 54

def []=(key, value)
  @datum[:headers] ||= {}
  @datum[:headers][key] = value
end

#hostObject



38
39
40
41
42
43
44
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 38

def host
  if hostname = (self['host'] || self['Host'])
    hostname.split(':').first
  else
    @datum[:host]
  end
end

#methodObject



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

def method
  @datum[:method].to_s.upcase
end

#typeObject



34
35
36
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 34

def type
  "Excon"
end

#uriObject



59
60
61
# File 'lib/new_relic/agent/http_clients/excon_wrappers.rb', line 59

def uri
  URI.parse("#{@datum[:scheme]}://#{@datum[:host]}:#{@datum[:port]}#{@datum[:path]}")
end