Class: SdrClient::RedesignedClient::UploadFiles
- Inherits:
-
Object
- Object
- SdrClient::RedesignedClient::UploadFiles
- Defined in:
- lib/sdr_client/redesigned_client/upload_files.rb
Overview
The file uploading part of a deposit
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_metadata:, filepath_map:) ⇒ UploadFiles
constructor
A new instance of UploadFiles.
-
#upload ⇒ Array<DirectUploadResponse>
The responses from the server for the uploads.
Constructor Details
#initialize(file_metadata:, filepath_map:) ⇒ UploadFiles
Returns a new instance of UploadFiles.
15 16 17 18 |
# File 'lib/sdr_client/redesigned_client/upload_files.rb', line 15 def initialize(file_metadata:, filepath_map:) @file_metadata = @filepath_map = filepath_map end |
Class Method Details
.upload(file_metadata:, filepath_map:) ⇒ Object
9 10 11 |
# File 'lib/sdr_client/redesigned_client/upload_files.rb', line 9 def self.upload(file_metadata:, filepath_map:) new(file_metadata: , filepath_map: filepath_map).upload end |
Instance Method Details
#upload ⇒ Array<DirectUploadResponse>
Returns the responses from the server for the uploads.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sdr_client/redesigned_client/upload_files.rb', line 21 def upload .map do |filepath, | direct_upload(.to_json).tap do |response| # ActiveStorage modifies the filename provided in response, so setting here with the relative filename response.filename = filepath upload_file(response) logger.info("Upload of #{filepath} complete") end end end |