Class: AWS::S3::ObjectUploadCollection
- Inherits:
-
Object
- Object
- AWS::S3::ObjectUploadCollection
- Includes:
- Core::Model, Enumerable
- Defined in:
- lib/aws/s3/object_upload_collection.rb
Overview
Represents uploads in progress for a single object.
Instance Attribute Summary collapse
-
#object ⇒ S3Object
readonly
The object to which the uploads belong.
Attributes included from Core::Model
Instance Method Summary collapse
-
#[](id) ⇒ MultipartUpload
An object representing the upload with the given ID.
-
#create(options = {}) ⇒ Object
Creates a new multipart upload.
-
#each(options = {}) {|upload| ... } ⇒ nil
Iterates the uploads in the collection.
-
#initialize(object, opts = {}) ⇒ ObjectUploadCollection
constructor
A new instance of ObjectUploadCollection.
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(object, opts = {}) ⇒ ObjectUploadCollection
Returns a new instance of ObjectUploadCollection.
33 34 35 36 37 38 39 |
# File 'lib/aws/s3/object_upload_collection.rb', line 33 def initialize(object, opts = {}) @all_uploads = MultipartUploadCollection.new(object.bucket). with_prefix(object.key) @object = object super end |
Instance Attribute Details
#object ⇒ S3Object (readonly)
Returns The object to which the uploads belong.
30 31 32 |
# File 'lib/aws/s3/object_upload_collection.rb', line 30 def object @object end |
Instance Method Details
#[](id) ⇒ MultipartUpload
Returns An object representing the upload with the given ID.
70 71 72 |
# File 'lib/aws/s3/object_upload_collection.rb', line 70 def [] id MultipartUpload.new(object, id) end |
#create(options = {}) ⇒ Object
Creates a new multipart upload. It is usually more convenient to use S3Object#multipart_upload.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/aws/s3/object_upload_collection.rb', line 43 def create( = {}) [:storage_class] = :reduced_redundancy if .delete(:reduced_redundancy) initiate_opts = { :bucket_name => object.bucket.name, :key => object.key }.merge() id = client.initiate_multipart_upload(initiate_opts).upload_id MultipartUpload.new(object, id) end |
#each(options = {}) {|upload| ... } ⇒ nil
Iterates the uploads in the collection.
59 60 61 62 63 64 |
# File 'lib/aws/s3/object_upload_collection.rb', line 59 def each( = {}, &block) @all_uploads.each() do |upload| yield(upload) if upload.object.key == @object.key end nil end |