Class: ForemanSlack::SlackNotify
- Inherits:
-
Object
- Object
- ForemanSlack::SlackNotify
- Defined in:
- app/services/foreman_slack/slack_notify.rb
Instance Method Summary collapse
-
#initialize ⇒ SlackNotify
constructor
A new instance of SlackNotify.
- #notify(message) ⇒ Object
Constructor Details
#initialize ⇒ SlackNotify
Returns a new instance of SlackNotify.
4 5 6 7 8 9 |
# File 'app/services/foreman_slack/slack_notify.rb', line 4 def initialize @webhook = Setting[:slack_webhook] @channel = Setting[:slack_channel] || '#general' #each Slack team has a general channel @username = Setting[:slack_username] || 'foreman' @notifier = ::Slack::Notifier.new(@webhook, :channel => @channel, :username => @username) if valid_webhook? end |
Instance Method Details
#notify(message) ⇒ Object
11 12 13 |
# File 'app/services/foreman_slack/slack_notify.rb', line 11 def notify() @notifier.ping() if @notifier end |