Class: VirustotalAPI::URL

Inherits:
Base
  • Object
show all
Defined in:
lib/virustotal_api/url.rb

Overview

A class for ‘/urls’ API

Instance Attribute Summary

Attributes inherited from Base

#id, #report, #report_url

Class Method Summary collapse

Methods inherited from Base

#api_uri, api_uri, #exists?, #initialize, perform, perform_absolute, url_identifier

Constructor Details

This class inherits a constructor from VirustotalAPI::Base

Class Method Details

.analyse(resource, api_key) ⇒ VirustotalAPI::URL

Analyse a URL again.

Parameters:

  • resource (String)

    as an ip/domain/url

  • api_key (String)

    The key for virustotal

Returns:



23
24
25
26
# File 'lib/virustotal_api/url.rb', line 23

def self.analyse(resource, api_key)
  report = perform("/urls/#{url_identifier(resource)}/analyse", api_key, :post)
  new(report)
end

.find(resource, api_key) ⇒ VirustotalAPI::URL

Find a URL.

Parameters:

  • resource (String)

    as an ip/domain/url

  • api_key (String)

    The key for virustotal

Returns:



13
14
15
16
# File 'lib/virustotal_api/url.rb', line 13

def self.find(resource, api_key)
  report = perform("/urls/#{url_identifier(resource)}", api_key)
  new(report)
end

.upload(resource, api_key) ⇒ VirustotalAPI::URL

Upload a URL for detection.

Parameters:

  • resource (String)

    as an ip/domain/url

  • api_key (String)

    The key for virustotal

Returns:



33
34
35
36
# File 'lib/virustotal_api/url.rb', line 33

def self.upload(resource, api_key)
  report = perform('/urls', api_key, :post, url: resource)
  new(report)
end