main
1class FingerprintLookupJob < ActiveJob::Base
2 #ENDPOINT = "https://www.virustotal.com/vtapi/v2/file/report"
3 ENDPOINT = "https://www.virustotal.com/api/get_file_report.json"
4 queue_as :default
5
6 def perform(fingerprint)
7 response = Typhoeus.post(ENDPOINT, params: {
8 resource: fingerprint,
9 apiKey: ENV.fetch("VIRUS_TOTAL_API_KEY"),
10 })
11 report = JSON.parse(response.response_body)
12 disposition = Disposition.find_by(fingerprint: fingerprint)
13 disposition.file_reports.create!(data: report)
14 end
15end