Class: PurlFetcher::Client::UploadFiles
- Inherits:
-
Object
- Object
- PurlFetcher::Client::UploadFiles
- Defined in:
- lib/purl_fetcher/client/upload_files.rb
Overview
The file uploading part of a transfer
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/purl_fetcher/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/purl_fetcher/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/purl_fetcher/client/upload_files.rb', line 21 def upload .map do || filepath = .filename # ActiveStorage modifies the filename provided in response, so setting here with the relative filename direct_upload(.to_json).with_filename(filepath).tap do |response| upload_file(response) logger.info("Upload of #{filepath} complete") end end end |