Class: VirusTotal::Client::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/virustotal/clients/base.rb

Direct Known Subclasses

Analysis, Domain, File, Graph, IPAddress, URL

Constant Summary collapse

HOST =
"www.virustotal.com"
VERSION =
"v3"
BASE_URL =
"https://#{HOST}/api/#{VERSION}"
CONVERT_TABLE =
{
  analysis: "analyses",
  domain: "domains",
  file: "files",
  graph: "graphs",
  ipaddress: "ip_addresses",
  url: "urls",
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key: ENV["VIRUSTOTAL_API_KEY"]) ⇒ Base

Returns a new instance of Base.

Raises:

  • (ArgumentError)


25
26
27
28
# File 'lib/virustotal/clients/base.rb', line 25

def initialize(key: ENV["VIRUSTOTAL_API_KEY"])
  @key = key
  raise ArgumentError, "No key has been found or provided!" unless key?
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



23
24
25
# File 'lib/virustotal/clients/base.rb', line 23

def key
  @key
end