Class: PublicFiles

Inherits:
Service show all
Defined in:
lib/s3sec/services/public_files.rb

Defined Under Namespace

Classes: File

Instance Method Summary collapse

Methods inherited from Service

call

Instance Method Details

#call(bucket, extentions, tick = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/s3sec/services/public_files.rb', line 5

def call(bucket, extentions, tick = nil)
  bucket.keys.reduce([]) do |arr, key|
    tick.call if tick
    arr << File.new(key, bucket) if extentions.include?(key.split('.').last) &&
                                    CheckAcl.call(bucket.client.get_object_acl({bucket: bucket.name, key: key}))
    arr
  end
rescue => e
  puts e
  []
end