Sha256: da9983892ccbbaafe9cde371f0a145f2d53d4c8e48b59bf6a3a7f4242b675e78
Contents?: true
Size: 651 Bytes
Versions: 7
Compression:
Stored size: 651 Bytes
Contents
require 'aws-sdk' module Vman class S3 def initialize(bucket_uri) @bucket ||= Aws::S3::Resource.new.bucket(bucket_uri[5..-1]) end def list @bucket.objects end def find(key) @bucket.objects({ prefix: key }) end def store(file_path, key) @bucket.put_object({ body: File.open(file_path), key: key }) end # TODO custom, more descriptive error class def versions(key) _versions = @bucket.object_versions({ prefix: key }) if _versions.count == 0 raise "No object exists for supplied key: #{key}" end _versions end end end
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
vman-0.2.0 | lib/vman/s3.rb |
vman-0.1.5 | lib/vman/s3.rb |
vman-0.1.4 | lib/vman/s3.rb |
vman-0.1.3 | lib/vman/s3.rb |
vman-0.1.2 | lib/vman/s3.rb |
vman-0.1.1 | lib/vman/s3.rb |
vman-0.1.0 | lib/vman/s3.rb |