Class: KeycloakAdmin::GroupRepresentation

Inherits:
Representation show all
Defined in:
lib/keycloak-admin/representation/group_representation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Representation

#as_json, from_json, #to_json

Methods included from CamelJson

#camelize

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/keycloak-admin/representation/group_representation.rb', line 3

def attributes
  @attributes
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/keycloak-admin/representation/group_representation.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/keycloak-admin/representation/group_representation.rb', line 3

def name
  @name
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/keycloak-admin/representation/group_representation.rb', line 3

def path
  @path
end

#sub_group_countObject

Returns the value of attribute sub_group_count.



3
4
5
# File 'lib/keycloak-admin/representation/group_representation.rb', line 3

def sub_group_count
  @sub_group_count
end

#sub_groupsObject

Returns the value of attribute sub_groups.



3
4
5
# File 'lib/keycloak-admin/representation/group_representation.rb', line 3

def sub_groups
  @sub_groups
end

Class Method Details

.from_hash(hash) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/keycloak-admin/representation/group_representation.rb', line 10

def self.from_hash(hash)
  group                 = new
  group.id              = hash["id"]
  group.name            = hash["name"]
  group.path            = hash["path"]
  group.attributes      = hash.fetch("attributes", {}).map { |k, v| [k.to_sym, Array(v)] }.to_h
  group.sub_group_count = hash["subGroupCount"]
  group.sub_groups      = hash.fetch("subGroups", []).map { |sub_group_hash| self.from_hash(sub_group_hash) }
  group
end