Sha256: 9b7691b7cbe0527a38ea4462458f9d063a140c5e4a05eabde8176224fc31a7d8

Contents?: true

Size: 1.25 KB

Versions: 1139

Compression:

Stored size: 1.25 KB

Contents

module Aws
  module S3
    class MultipartUpload

      alias_method :basic_complete, :complete

      # Completes the upload, requires a list of completed parts. You can
      # provide the list of parts with `:part_number` and `:etag` values.
      #
      #     upload.complete(multipart_upload: { parts: [
      #       { part_number: 1, etag:'etag1' },
      #       { part_number: 2, etag:'etag2' },
      #       ...
      #     ]})
      #
      # Alternatively, you can pass **`compute_parts: true`** and the part
      # list will be computed by calling {Client#list_parts}.
      #
      #     upload.complete(compute_parts: true)
      #
      # @option options [Boolean] :compute_parts (false) When `true`,
      #   the {Client#list_parts} method will be called to determine
      #   the list of required part numbers and their ETags.
      #
      def complete(options = {})
        if options.delete(:compute_parts)
          options[:multipart_upload] = { parts: compute_parts }
        end
        basic_complete(options)
      end

      private

      def compute_parts
        parts.sort_by(&:part_number).each.with_object([]) do |part, part_list|
          part_list << { part_number: part.part_number, etag: part.etag }
        end
      end

    end
  end
end

Version data entries

1,139 entries across 1,139 versions & 3 rubygems

Version Path
aws-sdk-resources-2.11.632 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.631 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.630 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.629 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.628 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.627 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.626 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.625 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.624 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.623 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.622 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.621 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.620 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.619 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.618 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.617 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.616 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.615 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.614 lib/aws-sdk-resources/services/s3/multipart_upload.rb
aws-sdk-resources-2.11.613 lib/aws-sdk-resources/services/s3/multipart_upload.rb