Class: AWS::S3::ObjectUploadCollection
- Inherits:
-
Object
- Object
- AWS::S3::ObjectUploadCollection
- Includes:
- 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.
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.
Instance Attribute Details
#object ⇒ S3Object (readonly)
Returns The object to which the uploads belong.
36 37 38 |
# File 'lib/aws/s3/object_upload_collection.rb', line 36 def object @object end |
Instance Method Details
#[](id) ⇒ MultipartUpload
Returns An object representing the upload with the given ID.
76 77 78 |
# File 'lib/aws/s3/object_upload_collection.rb', line 76 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.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/aws/s3/object_upload_collection.rb', line 49 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.
65 66 67 68 69 70 |
# File 'lib/aws/s3/object_upload_collection.rb', line 65 def each( = {}, &block) @all_uploads.each() do |upload| yield(upload) if upload.object.key == @object.key end nil end |