lib/cocina/models/file_set.rb in cocina-models-0.26.0 vs lib/cocina/models/file_set.rb in cocina-models-0.27.0

- old
+ new

@@ -1,37 +1,27 @@ # frozen_string_literal: true module Cocina module Models - # Metadata for a File Set. See http://sul-dlss.github.io/cocina-models/maps/Fileset.json + # Metadata for a file set. + # See http://sul-dlss.github.io/cocina-models/maps/Fileset.json class FileSet < Struct include Checkable TYPES = [ Vocab.fileset ].freeze class Identification < Struct end - # Structural sub-schema for the FileSet + # Structural sub-schema that contains File (unlike the one in RequestFileSet which contains RequestFile) class Structural < Struct attribute :contains, Types::Strict::Array.of(Cocina::Models::File).meta(omittable: true) end + include FileSetAttributes attribute :externalIdentifier, Types::Strict::String - attribute :type, Types::String.enum(*TYPES) - attribute :label, Types::Strict::String - attribute :version, Types::Coercible::Integer - attribute(:identification, Identification.default { Identification.new }) attribute(:structural, Structural.default { Structural.new }) - - def self.from_dynamic(dyn) - FileSet.new(dyn) - end - - def self.from_json(json) - from_dynamic(JSON.parse(json)) - end end end end