Class: Miteru::Notifier
- Inherits:
-
Object
- Object
- Miteru::Notifier
- Defined in:
- lib/miteru/notifier.rb
Instance Method Summary collapse
Instance Method Details
#notifiable? ⇒ Boolean
21 22 23 |
# File 'lib/miteru/notifier.rb', line 21 def notifiable? Miteru.configuration.slack_webhook_url? && Miteru.configuration.post_to_slack? end |
#notify(url:, kits:, message:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/miteru/notifier.rb', line 8 def notify(url:, kits:, message:) attachement = Attachement.new(url) kits = kits.select(&:downloaded?) if notifiable? && kits.any? notifier = Slack::Notifier.new(Miteru.configuration.slack_webhook_url, channel: Miteru.configuration.slack_channel) notifier.post(text: .capitalize, attachments: attachement.to_a) end = .colorize(:light_red) if kits.any? puts "#{url}: #{}" end |