Sha256: cb05e8ebac4a8dc01c97c0cb407dbde12861ad429196788a8eacd3c5cf540e91

Contents?: true

Size: 697 Bytes

Versions: 20

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

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

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

        super(base_url, headers: headers)
      end

      #
      # @param [Hash] payload
      #
      # @return [Hash]
      #
      def create_event(payload)
        res = post("/events/add", json: payload)
        JSON.parse(res.body.to_s)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mihari-5.4.9 lib/mihari/clients/misp.rb
mihari-5.4.8 lib/mihari/clients/misp.rb
mihari-5.4.7 lib/mihari/clients/misp.rb
mihari-5.4.6 lib/mihari/clients/misp.rb
mihari-5.4.5 lib/mihari/clients/misp.rb
mihari-5.4.4 lib/mihari/clients/misp.rb
mihari-5.4.3 lib/mihari/clients/misp.rb
mihari-5.4.2 lib/mihari/clients/misp.rb
mihari-5.4.1 lib/mihari/clients/misp.rb
mihari-5.4.0 lib/mihari/clients/misp.rb
mihari-5.3.2 lib/mihari/clients/misp.rb
mihari-5.3.1 lib/mihari/clients/misp.rb
mihari-5.3.0 lib/mihari/clients/misp.rb
mihari-5.2.4 lib/mihari/clients/misp.rb
mihari-5.2.3 lib/mihari/clients/misp.rb
mihari-5.2.2 lib/mihari/clients/misp.rb
mihari-5.2.1 lib/mihari/clients/misp.rb
mihari-5.2.0 lib/mihari/clients/misp.rb
mihari-5.1.4 lib/mihari/clients/misp.rb
mihari-5.1.3 lib/mihari/clients/misp.rb