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, #model, #on_failure, #on_success, #on_warning, #retry_waitsec

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Config::Helpers

included

Constructor Details

#initialize(model, &block) ⇒ Slack

Returns a new instance of Slack.



40
41
42
43
44
45
46
# File 'lib/backup/notifier/slack.rb', line 40

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



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

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:



31
32
33
# File 'lib/backup/notifier/slack.rb', line 31

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]



38
39
40
# File 'lib/backup/notifier/slack.rb', line 38

def send_log_on
  @send_log_on
end

#teamObject

The Team name



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

def team
  @team
end

#tokenObject

The Integration Token



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

def token
  @token
end

#usernameObject

The username to display along with the notification



23
24
25
# File 'lib/backup/notifier/slack.rb', line 23

def username
  @username
end