Class: Vidar::SentryNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/vidar/sentry_notification.rb

Instance Method Summary collapse

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

#callObject



13
14
15
16
17
18
19
# 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
end

#configured?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/vidar/sentry_notification.rb', line 9

def configured?
  !webhook_url.to_s.empty?
end