Sha256: 5d387d1437b081e0a15ab11f4a5d0da53336b63704fd61671462af8f210ab6f9

Contents?: true

Size: 971 Bytes

Versions: 10

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

require "normalize_country"

module Mihari
  module Analyzers
    #
    # Onyphe analyzer
    #
    class Onyphe < Base
      # @return [String, nil]
      attr_reader :api_key

      #
      # @param [String] query
      # @param [Hash, nil] options
      # @param [String, nil] api_key
      #
      def initialize(query, options: nil, api_key: nil)
        super(query, options: options)

        @api_key = api_key || Mihari.config.onyphe_api_key
      end

      def artifacts
        client.datascan_with_pagination(
          query,
          pagination_limit: pagination_limit
        ).map(&:artifacts).flatten
      end

      class << self
        def configuration_keys
          %w[onyphe_api_key]
        end
      end

      private

      def client
        Clients::Onyphe.new(
          api_key: api_key,
          pagination_interval: pagination_interval,
          timeout: timeout
        )
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mihari-7.1.3 lib/mihari/analyzers/onyphe.rb
mihari-7.1.2 lib/mihari/analyzers/onyphe.rb
mihari-7.1.1 lib/mihari/analyzers/onyphe.rb
mihari-7.1.0 lib/mihari/analyzers/onyphe.rb
mihari-7.0.5 lib/mihari/analyzers/onyphe.rb
mihari-7.0.4 lib/mihari/analyzers/onyphe.rb
mihari-7.0.3 lib/mihari/analyzers/onyphe.rb
mihari-7.0.2 lib/mihari/analyzers/onyphe.rb
mihari-7.0.1 lib/mihari/analyzers/onyphe.rb
mihari-7.0.0 lib/mihari/analyzers/onyphe.rb