Sha256: 13150f7c4ed7e47d09ce1933f7975cb08c87f1f6a9354838cd1e163a620d773f

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Notifiers
    class TheHive < Base
      attr_reader :api

      def initialize
        @api = Mihari::TheHive.new
      end

      # @return [true, false]
      def valid?
        api.valid?
      end

      def notify(title:, description:, artifacts:)
        return if artifacts.empty?

        res = api.create_alert(title: title, description: description, artifacts: artifacts.map(&:to_h))
        id = res.dig("id")
        puts "A new alret is created. (id: #{id})"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mihari-0.2.1 lib/mihari/notifiers/the_hive.rb
mihari-0.2.0 lib/mihari/notifiers/the_hive.rb
mihari-0.1.0 lib/mihari/notifiers/the_hive.rb