Sha256: 38cc7bc1aab16feb7c1c11db96bce645ba720cc952c468fd6478b3cb26480731

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require_relative 'base'

module VirustotalAPI
  # A class for '/urls' API
  class URL < Base
    # Find a URL.
    #
    # @param [String] resource as an ip/domain/url
    # @param [String] api_key The key for virustotal
    # @return [VirustotalAPI::URL] Report
    def self.find(resource, api_key)
      report = perform("/urls/#{url_identifier(resource)}", api_key)
      new(report)
    end

    # Analyse a URL again.
    #
    # @param [String] resource as an ip/domain/url
    # @param [String] api_key The key for virustotal
    # @return [VirustotalAPI::URL] Report
    def self.analyse(resource, api_key)
      report = perform("/urls/#{url_identifier(resource)}/analyse", api_key, :post)
      new(report)
    end

    # Upload a URL for detection.
    #
    # @param [String] resource as an ip/domain/url
    # @param [String] api_key The key for virustotal
    # @return [VirustotalAPI::URL] Report
    def self.upload(resource, api_key)
      report = perform('/urls', api_key, :post, url: resource)
      new(report)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virustotal_api_compat-0.1.7 lib/virustotal_api/url.rb