Sha256: 42e8f831dabf32654143914a809e7ec776793b5487686a13210c605f43596b29

Contents?: true

Size: 1017 Bytes

Versions: 9

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

module Cocina
  module Models
    # 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
      class Structural < Struct
        attribute :contains, Types::Strict::Array.of(Cocina::Models::File).meta(omittable: true)
      end

      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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cocina-models-0.26.0 lib/cocina/models/file_set.rb
cocina-models-0.25.0 lib/cocina/models/file_set.rb
cocina-models-0.24.0 lib/cocina/models/file_set.rb
cocina-models-0.23.0 lib/cocina/models/file_set.rb
cocina-models-0.22.2 lib/cocina/models/file_set.rb
cocina-models-0.22.1 lib/cocina/models/file_set.rb
cocina-models-0.22.0 lib/cocina/models/file_set.rb
cocina-models-0.21.0 lib/cocina/models/file_set.rb
cocina-models-0.20.0 lib/cocina/models/file_set.rb