Class: OneApm::Support::HTTPClients::NetHTTPRequest
- Inherits:
-
Object
- Object
- OneApm::Support::HTTPClients::NetHTTPRequest
- Defined in:
- lib/one_apm/support/http_clients/net_http_wrappers.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #host ⇒ Object
-
#initialize(connection, request) ⇒ NetHTTPRequest
constructor
A new instance of NetHTTPRequest.
- #method ⇒ Object
- #type ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(connection, request) ⇒ NetHTTPRequest
Returns a new instance of NetHTTPRequest.
7 8 9 10 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 7 def initialize(connection, request) @connection = connection @request = request end |
Instance Method Details
#[](key) ⇒ Object
28 29 30 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 28 def [](key) @request[key] end |
#[]=(key, value) ⇒ Object
32 33 34 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 32 def []=(key, value) @request[key] = value end |
#host ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 16 def host if hostname = self['host'] hostname.split(':').first else @connection.address end end |
#method ⇒ Object
24 25 26 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 24 def method @request.method end |
#type ⇒ Object
12 13 14 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 12 def type 'Net::HTTP' end |
#uri ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/one_apm/support/http_clients/net_http_wrappers.rb', line 36 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 |