Sha256: 90c7a0a7e3494f2bde0cad8aac7c4b20080c8cfd2fba79ca7a8f74d8afca0b7b

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

module SdrClient
  module Deposit
    # This strategy is for building one file set per uploaded file
    class DefaultFileSetBuilder
      # @return [Request] request The initial request
      # @param [Array<SdrClient::Deposit::Files::DirectUploadResponse>] uploads the uploaded files to attach.
      # @return [Request] a clone of this request with the uploads added
      def self.run(request:, uploads: [])
        file_sets = uploads.each_with_index.map do |upload, i|
          FileSet.new(uploads: [upload], label: "Object #{i + 1}")
        end
        request.with_file_sets(file_sets)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sdr-client-0.4.0 lib/sdr_client/deposit/default_file_set_builder.rb