Class: Checkups::SlackNotifier
- Inherits:
-
Object
- Object
- Checkups::SlackNotifier
- Defined in:
- lib/checkups/slack_notifier.rb
Instance Method Summary collapse
- #build_attachments(status, message, title = nil, title_link = nil) ⇒ Object
- #notify(checkup) ⇒ Object
- #send_attachments(_attachments) ⇒ Object
- #status_to_slack_color(status) ⇒ Object
Instance Method Details
#build_attachments(status, message, title = nil, title_link = nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/checkups/slack_notifier.rb', line 18 def (status, , title = nil, title_link = nil) = {"color": status_to_slack_color(status), "text": } [:title] = title if title [:title_link] = title_link if title_link [] end |
#notify(checkup) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/checkups/slack_notifier.rb', line 5 def notify(checkup) = (checkup.status, checkup., checkup.name, checkup.url) () end |
#send_attachments(_attachments) ⇒ Object
13 14 15 |
# File 'lib/checkups/slack_notifier.rb', line 13 def () raise "Must subclass Checkups::SlackNotifier#send_attachments" end |
#status_to_slack_color(status) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/checkups/slack_notifier.rb', line 26 def status_to_slack_color(status) case status when :ok, :info "good" when :warning "warning" when :error, :fatal "danger" end end |