Class: ExceptionHunter::Notifiers::SlackNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_hunter/notifiers/slack_notifier.rb

Overview

Notifier that sends a message to a Slack channel every time an exception is tracked.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, notifier) ⇒ SlackNotifier

Returns a new instance of SlackNotifier.



10
11
12
13
# File 'lib/exception_hunter/notifiers/slack_notifier.rb', line 10

def initialize(error, notifier)
  @error = error
  @notifier = notifier
end

Instance Attribute Details

#errorObject (readonly)



8
9
10
# File 'lib/exception_hunter/notifiers/slack_notifier.rb', line 8

def error
  @error
end

#notifierObject (readonly)



8
9
10
# File 'lib/exception_hunter/notifiers/slack_notifier.rb', line 8

def notifier
  @notifier
end

Instance Method Details

#notifyObject



15
16
17
18
# File 'lib/exception_hunter/notifiers/slack_notifier.rb', line 15

def notify
  slack_notifier = Slack::Notifier.new(notifier[:options][:webhook])
  slack_notifier.ping(slack_notification_message)
end