Sha256: 3be9bdb85a584d20bba021ef7a14e4ed3aacabff26b48259c1f70b8b77d7ba63

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Cocina
  module Models
    # An request to create an AdminPolicy object.
    # This is the same as AdminPolicy, except it doesn't have externalIdentifier.
    class RequestAdminPolicy < Struct
      attribute :type, Types::String.enum(*AdminPolicy::TYPES)
      attribute :label, Types::Strict::String
      attribute :version, Types::Coercible::Integer
      attribute(:access, AdminPolicy::Access.default { AdminPolicy::Access.new })
      attribute(:administrative, AdminPolicy::Administrative.default { AdminPolicy::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, AdminPolicy::Identification.default { AdminPolicy::Identification.new })
      attribute(:structural, AdminPolicy::Structural.default { AdminPolicy::Structural.new })

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cocina-models-0.26.0 lib/cocina/models/request_admin_policy.rb
cocina-models-0.25.0 lib/cocina/models/request_admin_policy.rb
cocina-models-0.24.0 lib/cocina/models/request_admin_policy.rb
cocina-models-0.23.0 lib/cocina/models/request_admin_policy.rb
cocina-models-0.22.2 lib/cocina/models/request_admin_policy.rb