Class: UniformNotifier::Slack

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

Constant Summary collapse

POSSIBLE_OPTIONS =
[:username, :channel]

Class Method Summary collapse

Methods inherited from Base

inline_notify, out_of_channel_notify

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/uniform_notifier/slack.rb', line 8

def active?
  @slack
end

.setup_connection(config = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/uniform_notifier/slack.rb', line 12

def setup_connection(config={})
  webhook_url, options = parse_config(config)
  fail_connection('webhook_url required for Slack notification') unless webhook_url

  require 'slack-notifier'
  @slack = ::Slack::Notifier.new webhook_url, options
rescue LoadError
  fail_connection 'You must install the slack-notifier gem to use Slack notification: '\
                  '`gem install slack-notifier`'
end