Class: Mihari::Emitters::Slack
- Defined in:
- lib/mihari/emitters/slack.rb
Instance Method Summary collapse
- #emit(title:, description:, artifacts:, tags: []) ⇒ Object
- #notifier ⇒ Object
- #to_attachments(artifacts) ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Base
Instance Method Details
#emit(title:, description:, artifacts:, tags: []) ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/mihari/emitters/slack.rb', line 116 def emit(title:, description:, artifacts:, tags: []) return if artifacts.empty? = (artifacts) = ["N/A"] if .empty? text = "#{title} (desc.: #{description} / tags: #{.join(', ')})" notifier.notify(text: text, attachments: ) end |
#notifier ⇒ Object
102 103 104 |
# File 'lib/mihari/emitters/slack.rb', line 102 def notifier @notifier ||= Notifiers::Slack.new end |
#to_attachments(artifacts) ⇒ Object
110 111 112 113 114 |
# File 'lib/mihari/emitters/slack.rb', line 110 def (artifacts) artifacts.map do |artifact| Attachment.new(data: artifact.data, data_type: artifact.data_type).to_a end.flatten end |
#valid? ⇒ Boolean
106 107 108 |
# File 'lib/mihari/emitters/slack.rb', line 106 def valid? notifier.valid? end |