Class: WitchDoctor::VirusScan
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- WitchDoctor::VirusScan
- Defined in:
- app/models/witch_doctor/virus_scan.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#file_url ⇒ Object
S3 will give url, file wil show mount point, we care just about s3.
- #scan_updated? ⇒ Boolean
- #set_scanned_at ⇒ Object
Instance Method Details
#as_json(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/witch_doctor/virus_scan.rb', line 11 def as_json(={}) attributes .slice('id', 'scan_result') .tap { |hash| hash.merge!('file_url' => file_url, 'scanned_at' => scanned_at.try(:utc).try(:iso8601)) } end |
#file_url ⇒ Object
S3 will give url, file wil show mount point, we care just about s3
21 22 23 |
# File 'app/models/witch_doctor/virus_scan.rb', line 21 def file_url resource.send(mount_point).url end |
#scan_updated? ⇒ Boolean
29 30 31 |
# File 'app/models/witch_doctor/virus_scan.rb', line 29 def scan_updated? scan_result.in? WitchDoctor::Antivirus::RESULTS end |
#set_scanned_at ⇒ Object
25 26 27 |
# File 'app/models/witch_doctor/virus_scan.rb', line 25 def set_scanned_at self.scanned_at = WitchDoctor.time_stamper.call end |