lib/mihari/emitters/webhook.rb in mihari-6.3.0 vs lib/mihari/emitters/webhook.rb in mihari-7.0.0
- old
+ new
@@ -2,11 +2,11 @@
require "erb"
module Mihari
module Emitters
- class PayloadTemplate < ERB
+ class ERBTemplate < ERB
class << self
def template
%{
{
"rule": {
@@ -20,11 +20,11 @@
<%= ',' if idx < (@artifacts.length - 1) %>
<% end %>
],
"tags": [
<% @rule.tags.each_with_index do |tag, idx| %>
- "<%= tag %>"
+ "<%= tag.name %>"
<%= ',' if idx < (@rule.tags.length - 1) %>
<% end %>
]
}
}
@@ -111,26 +111,26 @@
#
# Render template
#
# @return [String]
#
- def rendered_template
+ def render
options = {}
options[:template] = File.read(template) unless template.nil?
- payload_template = PayloadTemplate.new(
+ erb_template = ERBTemplate.new(
artifacts: artifacts,
rule: rule,
options: options
)
- payload_template.result
+ erb_template.result
end
#
# @return [Hash]
#
def json
- JSON.parse rendered_template
+ JSON.parse render
end
end
end
end