Sha256: 6c5839ba659770533ea31819a7536a4b176480673d54b5b5b180353209b6dfec

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Cocina
  module Models
    # attributes common to both Collection and RequestCollection
    # See http://sul-dlss.github.io/cocina-models/maps/Collection.json
    module CollectionAttributes
      def self.included(obj)
        obj.attribute(:access, Collection::Access.default { Collection::Access.new })
        obj.attribute(:administrative, Collection::Administrative.default { Collection::Administrative.new })
        # TODO: Allowing description to be omittable for now (until rolled out to consumers),
        # but I think it's actually required for every Collection
        obj.attribute :description, Description.optional.meta(omittable: true)
        obj.attribute(:identification, Collection::Identification.default { Collection::Identification.new })
        obj.attribute :label, Types::Strict::String
        obj.attribute(:structural, Collection::Structural.default { Collection::Structural.new })
        obj.attribute :type, Types::String.enum(*Collection::TYPES)
        obj.attribute :version, Types::Strict::Integer
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cocina-models-0.29.0 lib/cocina/models/collection_attributes.rb
cocina-models-0.28.0 lib/cocina/models/collection_attributes.rb
cocina-models-0.27.0 lib/cocina/models/collection_attributes.rb