Sha256: c73e9e8d2d48e494d2e46624c156e726f74f00a26a947e53180606cc999d6506

Contents?: true

Size: 627 Bytes

Versions: 5

Compression:

Stored size: 627 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:, tags: [])
        return if artifacts.empty?

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mihari-0.3.0 lib/mihari/notifiers/the_hive.rb
mihari-0.2.5 lib/mihari/notifiers/the_hive.rb
mihari-0.2.4 lib/mihari/notifiers/the_hive.rb
mihari-0.2.3 lib/mihari/notifiers/the_hive.rb
mihari-0.2.2 lib/mihari/notifiers/the_hive.rb