Class: VirusTotal::API

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of API.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
# File 'lib/virustotal/api.rb', line 13

def initialize(key: ENV["VIRUSTOTAL_API_KEY"])
  raise ArgumentError, "No API key has been found or provided! (setup your VIRUSTOTAL_API_KEY environment varialbe)" unless key

  @analysis = Client::Analysis.new(key: key)
  @domain = Client::Domain.new(key: key)
  @file = Client::File.new(key: key)
  @ip_address = Client::IPAddress.new(key: key)
  @url = Client::URL.new(key: key)
end

Instance Attribute Details

#analysisObject (readonly)

Returns the value of attribute analysis.



7
8
9
# File 'lib/virustotal/api.rb', line 7

def analysis
  @analysis
end

#domainObject (readonly)

Returns the value of attribute domain.



8
9
10
# File 'lib/virustotal/api.rb', line 8

def domain
  @domain
end

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/virustotal/api.rb', line 9

def file
  @file
end

#ip_addressObject (readonly)

Returns the value of attribute ip_address.



10
11
12
# File 'lib/virustotal/api.rb', line 10

def ip_address
  @ip_address
end

#urlObject (readonly)

Returns the value of attribute url.



11
12
13
# File 'lib/virustotal/api.rb', line 11

def url
  @url
end