class Mmtrix::Agent::HTTPClients::NetHTTPRequest

Public Class Methods

new(connection, request) click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 9
def initialize(connection, request)
  @connection = connection
  @request = request
end

Public Instance Methods

[](key) click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 30
def [](key)
  @request[key]
end
[]=(key, value) click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 34
def []=(key, value)
  @request[key] = value
end
host() click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 18
def host
  if hostname = self['host']
    hostname.split(':').first
  else
    @connection.address
  end
end
method() click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 26
def method
  @request.method
end
type() click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 14
def type
  'Net::HTTP'
end
uri() click to toggle source
# File lib/mmtrix/agent/http_clients/net_http_wrappers.rb, line 38
def uri
  case @request.path
  when /^https?:\/\//
    URI(@request.path)
  else
    scheme = @connection.use_ssl? ? 'https' : 'http'
    URI("#{scheme}://#{@connection.address}:#{@connection.port}#{@request.path}")
  end
end