Sha256: f3a15f715d48b4718e841be771c5bd090a362898c06c41637fe85264f57be817
Contents?: true
Size: 1000 Bytes
Versions: 1
Compression:
Stored size: 1000 Bytes
Contents
require 'aws-sdk' module Tori module Backend class S3 # You must be set bucket name. # And you can configurate to S3 # But, you can also configurate by AWS.config() # # example: # Tori.config.backend = Tori::Backend::S3.new( # bucket: 'photos', # region: '...', # s3_encryption_key: '...' # ) def initialize(bucket:, **s3_config) s3 = AWS::S3.new(s3_config) @bucket = s3.buckets[bucket] end def copy(form_path, filename) object(filename).write(file: form_path) end def delete(filename) object(filename).delete end def exist?(filename) object(filename).exists? end alias exists? exist? def read(filename) object(filename).read end def url(filename) object(filename).url_for(:read) end def object(filename) @bucket.objects[filename] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tori-0.0.4 | lib/tori/backend/s3.rb |