Class: SdrClient::Deposit::FileSet
- Inherits:
-
Object
- Object
- SdrClient::Deposit::FileSet
- Defined in:
- lib/sdr_client/deposit/file_set.rb
Overview
This represents the FileSet metadata that we send to the server for doing a deposit
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(label:, uploads: [], uploads_metadata: {}, files: [], type_strategy: FileTypeFileSetStrategy) ⇒ FileSet
constructor
A new instance of FileSet.
Constructor Details
#initialize(label:, uploads: [], uploads_metadata: {}, files: [], type_strategy: FileTypeFileSetStrategy) ⇒ FileSet
Returns a new instance of FileSet.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sdr_client/deposit/file_set.rb', line 12 def initialize(label:, uploads: [], uploads_metadata: {}, files: [], type_strategy: FileTypeFileSetStrategy) @label = label @type_strategy = type_strategy @files = if uploads.empty? files else uploads.map do |upload| File.new(**file_args(upload, .fetch(upload.filename, {}))) end end end |
Instance Method Details
#as_json ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sdr_client/deposit/file_set.rb', line 24 def as_json { type: type_strategy.run(files: files), label: label, structural: { contains: files.map(&:as_json) }, version: 1 } end |