main
 1module Scim
 2  module Shady
 3    class Group < ::Scim::Kit::V2::Resource
 4      def initialize(attributes = {})
 5        super(schemas: [self.class.schema], attributes: attributes)
 6      end
 7
 8      def self.schema(location: "/v2/Schemas/#{::Scim::Kit::V2::Schemas::GROUP}")
 9        schema = ::Scim::Kit::V2::Schema.new(id: ::Scim::Kit::V2::Schemas::GROUP, name: 'Group', location: location)
10        schema.add_attribute(name: :display_name, type: :string) do |x|
11          x.multi_valued = false
12          x.description = "A human-readable name for the Group.  REQUIRED."
13          x.required = false
14          x.case_exact = false
15          x.mutability = :read_write
16          x.returned = :default
17          x.uniqueness = :none
18        end
19        schema.add_attribute(name: :members, type: :complex) do |x|
20          x.multi_valued = true
21          x.description = "A list of members of the Group."
22          x.required = false
23          x.add_attribute(name: :value, type: :string) do |y|
24            y.multi_valued = false
25            y.description = "Identifier of the member of this Group."
26            y.required = false
27            y.case_exact = false
28            y.mutability = :immutable
29            y.returned = :default
30            y.uniqueness = :none
31          end
32          x.add_attribute(name: '$ref', type: :reference) do |y|
33            y.reference_types = ['User', 'Group']
34            y.multi_valued = false
35            y.description = "The URI corresponding to a SCIM resource that is a member of this Group."
36            y.required = false
37            y.case_exact = false
38            y.mutability = :immutable
39            y.returned = :default
40            y.uniqueness = :none
41          end
42          x.add_attribute(name: :type, type: :string) do |y|
43            y.multi_valued = false
44            y.description = "A label indicating the type of resource, e.g., 'User' or 'Group'."
45            y.required = false
46            y.case_exact = false
47            y.canonical_values = ['User', 'Group']
48            y.mutability = :immutable
49            y.returned = :default
50            y.uniqueness = :none
51          end
52        end
53        schema
54      end
55    end
56  end
57end