Sha256: f4a1f54565361849e8df373288603caa915188726633d057011be34bd96a01da

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

module SdrClient
  module Deposit
    # This represents the FileSet metadata that we send to the server for doing a deposit
    class FileSet
      def initialize(uploads: [], files: [])
        @files = if !uploads.empty?
                   uploads.map do |upload|
                     File.new(external_identifier: upload.signed_id, label: upload.filename, filename: upload.filename)
                   end
                 else
                   files
                 end
      end

      def as_json
        {
          "type": 'http://cocina.sul.stanford.edu/models/fileset.jsonld',
          structural: {
            hasMember: files.map(&:as_json)
          }
        }
      end

      private

      attr_reader :files
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sdr-client-0.3.0 lib/sdr_client/deposit/file_set.rb