Module: ActionSlack::Notifier
- Defined in:
- lib/action_slack/notifier.rb
Class Method Summary collapse
- .notify(url:, message:) ⇒ Object
- .notify_later(url, message) ⇒ Object
- .notify_now(url, message) ⇒ Object
Class Method Details
.notify(url:, message:) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/action_slack/notifier.rb', line 7 def notify(url:, message:) = ActionSlack.configuration.testflight? ? "[ActionSlack Test Posting]\n#{}\n" : if ActionSlack.configuration.async? notify_later(url, ) else notify_now(url, ) end end |
.notify_later(url, message) ⇒ Object
27 28 29 |
# File 'lib/action_slack/notifier.rb', line 27 def notify_later(url, ) SendJob.perform_later(url: url, message: ) end |
.notify_now(url, message) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/action_slack/notifier.rb', line 17 def notify_now(url, ) if ActionSlack.configuration.local? ActionSlack.logger.debug { "Post to Slack webhook url: #{url}, message: \"#{}\"" } else ActionSlack.logger.info { "Start posting to Slack webhook url: #{url}, message: \"#{}\"" } Slack::Notifier.new(url).post(text: ) ActionSlack.logger.info 'Posted to Slack' end end |