Sha256: 567c4f6e19520d139adf617256cccb5d6c112e61b6e3bdfe2a77410c6a6217d6

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Mihari
  module Clients
    #
    # PulseDive API client
    #
    class PulseDive < Base
      # @return [String]
      attr_reader :api_key

      #
      # @param [String] base_url
      # @param [String, nil] api_key
      # @param [Hash] headers
      # @param [Integer, nil] timeout
      #
      def initialize(base_url = "https://pulsedive.com", api_key:, headers: {}, timeout: nil)
        raise(ArgumentError, "api_key is required") unless api_key

        @api_key = api_key

        super(base_url, headers:, timeout:)
      end

      #
      # @param [String] ip_or_domain
      #
      # @return [Hash]
      #
      def get_indicator(ip_or_domain)
        get_json "/api/info.php", params: {indicator: ip_or_domain, key: api_key}
      end

      #
      # @param [String] indicator_id
      #
      # @return [Hash]
      #
      def get_properties(indicator_id)
        get_json "/api/info.php", params: {iid: indicator_id, get: "properties", key: api_key}
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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