Sha256: cfaf817120900cfe5a41d38fe41c5cc98d82a8f87e2ad89c522baa3ec057817d

Contents?: true

Size: 1.5 KB

Versions: 8

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true

module Cocina
  module Models
    class Collection < Struct
      include Checkable

      TYPES = ['http://cocina.sul.stanford.edu/models/collection.jsonld',
               'http://cocina.sul.stanford.edu/models/curated-collection.jsonld',
               'http://cocina.sul.stanford.edu/models/user-collection.jsonld',
               'http://cocina.sul.stanford.edu/models/exhibit.jsonld',
               'http://cocina.sul.stanford.edu/models/series.jsonld'].freeze

      # The content type of the Collection. Selected from an established set of values.
      attribute :type, Types::Strict::String.enum(*Collection::TYPES)
      # example: druid:bc123df4567
      attribute :externalIdentifier, Types::Strict::String
      # Primary processing label (can be same as title) for a Collection.
      attribute :label, Types::Strict::String
      # Version for the Collection within SDR.
      attribute :version, Types::Strict::Integer
      attribute(:access, CollectionAccess.default { CollectionAccess.new })
      attribute :administrative, Administrative.optional.meta(omittable: true)
      attribute :description, Description.optional.meta(omittable: true)
      attribute :identification, CollectionIdentification.optional.meta(omittable: true)

      def self.new(attributes = default_attributes, safe = false, validate = true, &block)
        Validator.validate(self, attributes.with_indifferent_access) if validate && name
        super(attributes, safe, &block)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cocina-models-0.63.1 lib/cocina/models/collection.rb
cocina-models-0.63.0 lib/cocina/models/collection.rb
cocina-models-0.62.1 lib/cocina/models/collection.rb
cocina-models-0.62.0 lib/cocina/models/collection.rb
cocina-models-0.61.3 lib/cocina/models/collection.rb
cocina-models-0.61.2 lib/cocina/models/collection.rb
cocina-models-0.61.1 lib/cocina/models/collection.rb
cocina-models-0.61.0 lib/cocina/models/collection.rb