class S3Antivirus::S3Record

Public Class Methods

new(record) click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 5
def initialize(record)
  @record = record # record data from SQS event structure
end

Public Instance Methods

bucket() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 15
def bucket
  @record['s3']['bucket']['name']
end
human_key() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 9
def human_key
  text = "s3://#{bucket}/#{key}"
  text += " (version: #{version})" if version
  text
end
key() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 19
def key
  URI.decode(@record['s3']['object']['key']).gsub('+', ' ')
end
max_size() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 35
def max_size
  conf['volume_size'] * 1073741824 / 2 # in bytes
end
oversized?() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 27
def oversized?
  size > max_size
end
size() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 31
def size
  @record['s3']['object']['size']
end
version() click to toggle source
# File lib/s3_antivirus/s3_record.rb, line 23
def version
  @record['s3']['object']['versionId']
end