Module: S3Proxy
- Defined in:
- lib/s3proxy.rb,
lib/s3proxy/version.rb
Constant Summary collapse
- VERSION =
"0.1.2"
Instance Method Summary collapse
Instance Method Details
#proxy_s3_file(bucket, key) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/s3proxy.rb', line 6 def proxy_s3_file(bucket, key) cached_file = cache_location(bucket, key) = { bucket: bucket, key: key, } [:if_modified_since] = File.mtime(cached_file) if File.exists?(cached_file) begin s3object = s3.get_object(, target: cached_file) rescue Aws::S3::Errors::NotModified .delete(:if_modified_since) s3object = s3.head_object() end File.new cached_file end |