class Sentry::DSN
Constants
- PORT_MAP
- REQUIRED_ATTRIBUTES
Attributes
port[R]
scheme[R]
secret_key[R]
Public Class Methods
new(dsn_string)
click to toggle source
# File lib/sentry/dsn.rb, line 10 def initialize(dsn_string) @raw_value = dsn_string uri = URI.parse(dsn_string) uri_path = uri.path.split('/') if uri.user # DSN-style string @project_id = uri_path.pop @public_key = uri.user @secret_key = !(uri.password.nil? || uri.password.empty?) ? uri.password : nil end @scheme = uri.scheme @host = uri.host @port = uri.port if uri.port @path = uri_path.join('/') end
Public Instance Methods
csp_report_uri()
click to toggle source
# File lib/sentry/dsn.rb, line 43 def csp_report_uri "#{server}/api/#{project_id}/security/?sentry_key=#{public_key}" end
envelope_endpoint()
click to toggle source
# File lib/sentry/dsn.rb, line 47 def envelope_endpoint "#{path}/api/#{project_id}/envelope/" end
server()
click to toggle source
# File lib/sentry/dsn.rb, line 37 def server server = "#{scheme}://#{host}" server += ":#{port}" unless port == PORT_MAP[scheme] server end
to_s()
click to toggle source
# File lib/sentry/dsn.rb, line 33 def to_s @raw_value end
valid?()
click to toggle source
# File lib/sentry/dsn.rb, line 29 def valid? REQUIRED_ATTRIBUTES.all? { |k| public_send(k) } end