Class: S3Antivirus::Tagger

Inherits:
Object
  • Object
show all
Includes:
AwsServices, Conf
Defined in:
lib/s3_antivirus/tagger.rb

Instance Method Summary collapse

Methods included from Conf

#conf

Methods included from AwsServices

#s3, #sns

Constructor Details

#initialize(s3_record) ⇒ Tagger

Returns a new instance of Tagger.



6
7
8
9
10
# File 'lib/s3_antivirus/tagger.rb', line 6

def initialize(s3_record)
  @s3_record = s3_record
  @bucket, @key, @version = s3_record.bucket, s3_record.key, s3_record.version
  @tag_key = conf['tag_key']
end

Instance Method Details

#tag(value) ⇒ Object

Different tag values:

clean
inflected
oversized


18
19
20
21
22
23
24
25
26
# File 'lib/s3_antivirus/tagger.rb', line 18

def tag(value)
  params = {
    bucket: @bucket,
    key: @key,
    tagging: {tag_set: [{key: @tag_key, value: value}]}
  }
  params[:version_id] = @version if @version
  s3.put_object_tagging(params)
end