Module: DebugBundle::Transport
- Defined in:
- lib/debugbundle/transport.rb
Defined Under Namespace
Classes: FileTransport, HttpConfigFetcher, HttpTransport, Result
Constant Summary
collapse
- RETRY_AFTER_CAP_SECONDS =
300
Class Method Summary
collapse
Class Method Details
.coerce_result(result) ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/debugbundle/transport.rb', line 32
def self.coerce_result(result)
return result if result.is_a?(Result)
raise TypeError, 'unsupported transport result' unless result.respond_to?(:status_code)
Result.new(
status_code: result.status_code.to_i,
retry_after_seconds: result.respond_to?(:retry_after_seconds) ? result.retry_after_seconds : nil
)
end
|
.sdk_config_endpoint(events_endpoint) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/debugbundle/transport.rb', line 15
def self.sdk_config_endpoint(events_endpoint)
uri = URI.parse(events_endpoint)
normalized_path = uri.path.to_s.sub(%r{/+$}, '')
uri.path = if normalized_path.end_with?('/sdk/config')
normalized_path
elsif normalized_path.end_with?('/events')
normalized_path.sub(%r{/events\z}, '/sdk/config')
else
"#{normalized_path}/sdk/config"
end
uri.query = nil
uri.fragment = nil
uri.to_s
rescue URI::InvalidURIError
events_endpoint.to_s.sub(%r{/events\z}, '/sdk/config')
end
|