Class: Integral::SlackBot
- Inherits:
-
Object
- Object
- Integral::SlackBot
- Defined in:
- lib/integral/slack_bot.rb
Overview
Interacts with Slack web hook
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(web_hook_url) ⇒ SlackBot
constructor
A new instance of SlackBot.
- #ping(message_options) ⇒ Object
Constructor Details
#initialize(web_hook_url) ⇒ SlackBot
Returns a new instance of SlackBot.
13 14 15 |
# File 'lib/integral/slack_bot.rb', line 13 def initialize(web_hook_url) @bot = Slack::Notifier.new(web_hook_url) end |
Class Method Details
.ping(opts) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/integral/slack_bot.rb', line 5 def self.ping(opts) return if Integral.slack_web_hook_url.blank? slackbot = SlackBot.new(Integral.slack_web_hook_url) slackbot.ping(opts) end |
Instance Method Details
#ping(message_options) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/integral/slack_bot.rb', line 18 def ping() ping_opts = {} = ([:message]) response = @bot.ping(.deep_stringify_keys, ping_opts) (response) if response != '200' end |