lib/cocina/models/admin_policy.rb in cocina-models-0.26.0 vs lib/cocina/models/admin_policy.rb in cocina-models-0.27.0

- old
+ new

@@ -48,38 +48,21 @@ attribute :default_object_rights, Types::Strict::String.optional.default(DEFAULT_OBJECT_RIGHTS) # which workflow to start when registering (used by Web Archive apos to start wasCrawlPreassemblyWF) attribute :registration_workflow, Types::String.optional.default(nil) - # Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers), + # TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers), # but I think it's actually required for every Admin Policy - attribute :hasAdminPolicy, Types::Coercible::String.optional.default(nil) + attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil) end class Identification < Struct end class Structural < Struct end + include AdminPolicyAttributes attribute :externalIdentifier, Types::Strict::String - 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.meta(omittable: true) - attribute(:identification, Identification.default { Identification.new }) - attribute(:structural, Structural.default { Structural.new }) - - def self.from_dynamic(dyn) - AdminPolicy.new(dyn) - end - - def self.from_json(json) - from_dynamic(JSON.parse(json)) - end end end end