Sha256: 845dc22f1dd392b700f0f56d6cf73a7476eb66b1a968f2487f24dd9336280e16

Contents?: true

Size: 739 Bytes

Versions: 8

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Clients
    #
    # MISP API client
    #
    class MISP < Base
      #
      # @param [String] base_url
      # @param [String, nil] api_key
      # @param [Hash] headers
      # @param [Integer, nil] timeout
      #
      def initialize(base_url, api_key:, headers: {}, timeout: nil)
        raise(ArgumentError, "api_key is required") unless api_key

        headers["authorization"] = api_key
        headers["accept"] = "application/json"

        super(base_url, headers:, timeout:)
      end

      #
      # @param [Hash] payload
      #
      # @return [Hash]
      #
      def create_event(payload)
        post_json("/events/add", json: payload)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mihari-8.0.0 lib/mihari/clients/misp.rb
mihari-7.6.4 lib/mihari/clients/misp.rb
mihari-7.6.3 lib/mihari/clients/misp.rb
mihari-7.6.2 lib/mihari/clients/misp.rb
mihari-7.6.1 lib/mihari/clients/misp.rb
mihari-7.6.0 lib/mihari/clients/misp.rb
mihari-7.5.0 lib/mihari/clients/misp.rb
mihari-7.4.0 lib/mihari/clients/misp.rb