Class: OneApm::Support::HTTPClients::ExconHTTPRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/one_apm/support/http_clients/excon_wrappers.rb

Instance Method Summary collapse

Constructor Details

#initialize(datum) ⇒ ExconHTTPRequest

Returns a new instance of ExconHTTPRequest.



28
29
30
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 28

def initialize(datum)
  @datum = datum
end

Instance Method Details

#[](key) ⇒ Object



48
49
50
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 48

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

#[]=(key, value) ⇒ Object



52
53
54
55
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 52

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

#hostObject



36
37
38
39
40
41
42
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 36

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

#methodObject



44
45
46
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 44

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

#typeObject



32
33
34
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 32

def type
  "Excon"
end

#uriObject



57
58
59
# File 'lib/one_apm/support/http_clients/excon_wrappers.rb', line 57

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