lib/cocina/models/admin_policy.rb in cocina-models-0.15.0 vs lib/cocina/models/admin_policy.rb in cocina-models-0.16.0
- old
+ new
@@ -80,10 +80,13 @@
attribute :type, Types::String.enum(*TYPES)
attribute :label, Types::Strict::String
attribute :version, Types::Coercible::Integer
attribute(:access, Access.default { Access.new })
attribute(:administrative, Administrative.default { 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, Identification.default { Identification.new })
attribute(:structural, Structural.default { Structural.new })
def self.from_dynamic(dyn)
params = {
@@ -93,9 +96,10 @@
version: dyn['version']
}
# params[:access] = Access.from_dynamic(dyn['access']) if dyn['access']
params[:administrative] = Administrative.from_dynamic(dyn['administrative']) if dyn['administrative']
+ params[:description] = Description.from_dynamic(dyn.fetch('description'))
AdminPolicy.new(params)
end
def self.from_json(json)
from_dynamic(JSON.parse(json))