Class: VirusTotal::Response
- Inherits:
-
Object
- Object
- VirusTotal::Response
show all
- Defined in:
- lib/virus_total/response.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(resp) ⇒ Response
Returns a new instance of Response.
8
9
10
|
# File 'lib/virus_total/response.rb', line 8
def initialize(resp)
@response = JSON.parse(resp)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
35
36
37
|
# File 'lib/virus_total/response.rb', line 35
def method_missing(name, *args)
@response[name.to_s]
end
|
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
6
7
8
|
# File 'lib/virus_total/response.rb', line 6
def response
@response
end
|
Instance Method Details
#danger_brands ⇒ Object
31
32
33
|
# File 'lib/virus_total/response.rb', line 31
def danger_brands
dangers.keys
end
|
#dangers ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/virus_total/response.rb', line 18
def dangers
return {} unless scans
dangers = {}
scans.each_pair do |key, hash|
next unless hash["detected"]
dangers.merge!({ key => hash })
end
dangers
end
|
#info ⇒ Object
12
13
14
15
16
|
# File 'lib/virus_total/response.rb', line 12
def info
return unless @response
@response.tap { |hash| hash.delete("scans") }
end
|