Sha256: f9d20920cd94e82367542088e7d43f56584b04ac00dd8bf79874005ac87c3eb1

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Cocina
  module Models
    # A request to create a digital repository collection.
    # This is the same as Collection, except it doesn't have externalIdentifier.
    # See http://sul-dlss.github.io/cocina-models/maps/Collection.json
    class RequestCollection < Struct
      attribute :type, Types::String.enum(*Collection::TYPES)
      attribute :label, Types::Strict::String
      attribute :version, Types::Coercible::Integer
      attribute(:access, Collection::Access.default { Collection::Access.new })
      attribute(:administrative, Collection::Administrative.default { Collection::Administrative.new })
      # Allowing description to be omittable for now (until rolled out to consumers),
      # but I think it's actually required for every DRO
      attribute :description, Description.optional.default(nil)
      attribute(:identification, Collection::Identification.default { Collection::Identification.new })
      attribute(:structural, Collection::Structural.default { Collection::Structural.new })

      def self.from_dynamic(dyn)
        RequestCollection.new(dyn)
      end

      def self.from_json(json)
        from_dynamic(JSON.parse(json))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cocina-models-0.22.1 lib/cocina/models/request_collection.rb
cocina-models-0.22.0 lib/cocina/models/request_collection.rb
cocina-models-0.21.0 lib/cocina/models/request_collection.rb
cocina-models-0.20.0 lib/cocina/models/request_collection.rb