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(uploads: [], uploads_metadata: {}, files: [], label:) ⇒ FileSet
constructor
A new instance of FileSet.
Constructor Details
#initialize(uploads: [], uploads_metadata: {}, files: [], label:) ⇒ FileSet
Returns a new instance of FileSet.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sdr_client/deposit/file_set.rb', line 11 def initialize(uploads: [], uploads_metadata: {}, files: [], label:) @label = label @files = if !uploads.empty? uploads.map do |upload| File.new(**file_args(upload, .fetch(upload.filename, {}))) end else files end end |
Instance Method Details
#as_json ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sdr_client/deposit/file_set.rb', line 22 def as_json { "type": 'http://cocina.sul.stanford.edu/models/resources/file.jsonld', "label": label, structural: { contains: files.map(&:as_json) }, version: 1 } end |