Class: Miteru::Notifiers::Slack
- Defined in:
- lib/miteru/notifiers/slack.rb
Instance Method Summary collapse
- #notifiable? ⇒ Boolean
-
#notify(website) ⇒ Object
Notifiy to Slack.
Instance Method Details
#notifiable? ⇒ Boolean
24 25 26 |
# File 'lib/miteru/notifiers/slack.rb', line 24 def notifiable? Miteru.configuration.slack_webhook_url? && Miteru.configuration.post_to_slack? end |
#notify(website) ⇒ Object
Notifiy to Slack
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/miteru/notifiers/slack.rb', line 11 def notify(website) attachement = Attachement.new(website.url) kits = website.kits.select(&:downloaded?) if notifiable? && kits.any? notifier = Slack::Notifier.new(Miteru.configuration.slack_webhook_url, channel: Miteru.configuration.slack_channel) notifier.post(text: website..capitalize, attachments: attachement.to_a) end = kits.any? ? website..colorize(:light_red) : website. Miteru.logger.info "#{website.url}: #{}" end |