Module: Jobly::Slack

Defined in:
lib/jobly/helpers/slack.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/jobly/helpers/slack.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#slackObject



27
28
29
# File 'lib/jobly/helpers/slack.rb', line 27

def slack
  @slack ||= slack!
end

#slack!Object

Raises:

  • (ArgumentError)


31
32
33
34
35
36
37
38
39
# File 'lib/jobly/helpers/slack.rb', line 31

def slack!
  raise ArgumentError, 'Slack webhook is not set' unless Jobly.slack_webhook

  opts = {
    channel:  self.class.slack_channel,
    username: self.class.slack_user,
  }
  ::Slack::Notifier.new Jobly.slack_webhook, opts
end