Class: LogBrew::NetHttpTracingClient
- Inherits:
-
Object
- Object
- LogBrew::NetHttpTracingClient
show all
- Defined in:
- lib/logbrew/http_client_tracing.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(http, client:, on_capture_error: nil) ⇒ NetHttpTracingClient
Returns a new instance of NetHttpTracingClient.
82
83
84
85
86
|
# File 'lib/logbrew/http_client_tracing.rb', line 82
def initialize(http, client:, on_capture_error: nil)
@http = http
@client = client
@on_capture_error = on_capture_error
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *arguments, &block) ⇒ Object
106
107
108
109
110
|
# File 'lib/logbrew/http_client_tracing.rb', line 106
def method_missing(name, *arguments, &block)
return super unless @http.respond_to?(name)
@http.public_send(name, *arguments, &block)
end
|
Instance Attribute Details
#http ⇒ Object
Returns the value of attribute http.
80
81
82
|
# File 'lib/logbrew/http_client_tracing.rb', line 80
def http
@http
end
|
Instance Method Details
#request(request, body = nil, &block) ⇒ Object
88
89
90
91
92
93
94
95
|
# File 'lib/logbrew/http_client_tracing.rb', line 88
def request(request, body = nil, &block)
HttpClientTracing.capture_net_http(
@http,
request,
client: @client,
on_capture_error: @on_capture_error
) { @http.request(request, body, &block) }
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
112
113
114
|
# File 'lib/logbrew/http_client_tracing.rb', line 112
def respond_to_missing?(name, include_private = false)
@http.respond_to?(name, include_private) || super
end
|
#start(*arguments) ⇒ Object
97
98
99
100
101
102
103
104
|
# File 'lib/logbrew/http_client_tracing.rb', line 97
def start(*arguments)
unless block_given?
started = @http.start(*arguments)
return started.equal?(@http) ? self : started
end
@http.start(*arguments) { yield self }
end
|