class ExceptionNotifier::DetailedSlackNotifier

notifier plugin for Slack, implementing both initialize and call

Attributes

notifier_options[R]
username[R]
webhook_url[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/exception_notifier/detailed_slack_notifier.rb, line 7
def initialize(options = {})
  @webhook_url = options[:webhook_url]
  @notifier_options = options.select { |key, _value| %i(username channel).include?(key) }
end

Public Instance Methods

call(exception, options = {}) click to toggle source
# File lib/exception_notifier/detailed_slack_notifier.rb, line 12
def call(exception, options = {})
  notification = DetailedSlackNotification.new(exception, options)
  slack_notifier.ping notification.message, attachments: notification.attachments
end

Private Instance Methods

slack_notifier() click to toggle source
# File lib/exception_notifier/detailed_slack_notifier.rb, line 21
def slack_notifier
  @slack_notifier ||= Slack::Notifier.new webhook_url, notifier_options
end