Class: Backup::Notifier::Slack

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/notifier/slack.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#max_retries, #message, #model, #on_failure, #on_success, #on_warning, #retry_waitsec

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Config::Helpers

included

Methods included from Utilities::Helpers

#utility_remote

Constructor Details

#initialize(model, &block) ⇒ Slack

Returns a new instance of Slack.



36
37
38
39
40
41
42
# File 'lib/backup/notifier/slack.rb', line 36

def initialize(model, &block)
  super
  instance_eval(&block) if block_given?

  @send_log_on ||= [:warning, :failure]
  @icon_emoji  ||= ':floppy_disk:'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers

Instance Attribute Details

#channelObject

The channel to send messages to



15
16
17
# File 'lib/backup/notifier/slack.rb', line 15

def channel
  @channel
end

#icon_emojiObject

The emoji icon to display along with the notification

See www.emoji-cheat-sheet.com for a list of icons.

Default: :floppy_disk:



27
28
29
# File 'lib/backup/notifier/slack.rb', line 27

def icon_emoji
  @icon_emoji
end

#send_log_onObject

Array of statuses for which the log file should be attached.

Available statuses are: ‘:success`, `:warning` and `:failure`. Default: [:warning, :failure]



34
35
36
# File 'lib/backup/notifier/slack.rb', line 34

def send_log_on
  @send_log_on
end

#usernameObject

The username to display along with the notification



19
20
21
# File 'lib/backup/notifier/slack.rb', line 19

def username
  @username
end

#webhook_urlObject

The incoming webhook url



11
12
13
# File 'lib/backup/notifier/slack.rb', line 11

def webhook_url
  @webhook_url
end