Sha256: 075fca87da92f2a96ed54a08ef62e37d33e95a37a4ba08dac619569d4720a2eb

Contents?: true

Size: 807 Bytes

Versions: 21

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Clients
    class TheHive < Base
      #
      # @param [String] base_url
      # @param [String, nil] 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

      #
      # @param [Hash] json
      #
      # @return [Hash]
      #
      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

21 entries across 21 versions & 1 rubygems

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