Sha256: 4471a9fe09c4e9f1de0bdad5644f6ed6dcd25210ace76a120064e96e22155b85

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Clients
    class TheHive < Base
      #
      # @param [String] base_url
      # @param [String] api_key
      # @param [String, nil] api_version
      # @param [Hash] headers
      #
      def initialize(base_url, api_key:, api_version:, headers: {})
        raise(ArgumentError, "'api_key' argument is required") unless api_key

        base_url += "/#{api_version}" unless api_version.nil?
        headers["authorization"] = "Bearer #{api_key}"

        super(base_url, headers: headers)
      end

      def alert(json)
        json = json.to_camelback_keys.compact
        res = post("/alert", json: json)
        JSON.parse(res.body.to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mihari-5.1.1 lib/mihari/clients/the_hive.rb