class AWS::S3::UploadedPart
Represents a part of a multipart upload that has been uploaded to S3
.
@example Get the total size of the uploaded parts
upload.parts.inject(0) { |sum, part| sum + part.size }
Attributes
part_number[R]
@return [Integer] The part number.
upload[R]
@return [MultipartUpload] The upload to which this belongs.
Public Class Methods
new(upload, part_number, opts = {})
click to toggle source
@private
Calls superclass method
AWS::Core::Model::new
# File lib/aws/s3/uploaded_part.rb, line 33 def initialize(upload, part_number, opts = {}) @upload = upload @part_number = part_number super end
Public Instance Methods
==(other)
click to toggle source
# File lib/aws/s3/uploaded_part.rb, line 39 def ==(other) other.kind_of?(UploadedPart) and other.upload == upload and other.part_number == part_number end
Also aliased as: eql?
etag()
click to toggle source
@return [String] The ETag of the part.
# File lib/aws/s3/uploaded_part.rb, line 59 def etag get_attribute(:etag) end
last_modified()
click to toggle source
@return [DateTime] The time at which the part was last
modified.
# File lib/aws/s3/uploaded_part.rb, line 54 def last_modified get_attribute(:last_modified) end
size()
click to toggle source
@return [Integer] The size of the part as it currently
exists in S3.
# File lib/aws/s3/uploaded_part.rb, line 48 def size get_attribute(:size) end
Private Instance Methods
get_attribute(name)
click to toggle source
@private
# File lib/aws/s3/uploaded_part.rb, line 65 def get_attribute(name) (resp = client.list_parts(:bucket_name => upload.object.bucket.name, :key => upload.object.key, :upload_id => upload.id, :part_number_marker => part_number-1, :max_parts => 1) and part = resp.parts.first and part.part_number == part_number and part.send(name)) or raise "part 3 of upload abc123 does not exist" end