Class: Vidar::SentryNotification
- Inherits:
-
Object
- Object
- Vidar::SentryNotification
- Defined in:
- lib/vidar/sentry_notification.rb
Instance Method Summary collapse
- #call ⇒ Object
- #configured? ⇒ Boolean
-
#initialize(revision:, deploy_config:) ⇒ SentryNotification
constructor
A new instance of SentryNotification.
Constructor Details
#initialize(revision:, deploy_config:) ⇒ SentryNotification
Returns a new instance of SentryNotification.
3 4 5 6 7 |
# File 'lib/vidar/sentry_notification.rb', line 3 def initialize(revision:, deploy_config:) @revision = revision @webhook_url = deploy_config.sentry_webhook_url @connection = Faraday.new end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vidar/sentry_notification.rb', line 13 def call connection.post do |req| req.url webhook_url req.headers["Content-Type"] = "application/json" req.body = data.to_json end rescue Faraday::Error => e warn "Sentry notification request failed: #{e.}" nil end |
#configured? ⇒ Boolean
9 10 11 |
# File 'lib/vidar/sentry_notification.rb', line 9 def configured? !webhook_url.to_s.empty? end |