Class: KeycloakAdmin::ClientScopeProtocolMapperClient
- Inherits:
-
Client
- Object
- Client
- KeycloakAdmin::ClientScopeProtocolMapperClient
show all
- Defined in:
- lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb
Instance Method Summary
collapse
Methods inherited from Client
#create_payload, #created_id, #current_token, #execute_http, #headers, #server_url
Constructor Details
Returns a new instance of ClientScopeProtocolMapperClient.
4
5
6
7
8
9
10
11
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 4
def initialize(configuration, realm_client, client_scope_id)
super(configuration)
raise ArgumentError.new("realm must be defined") unless realm_client.name_defined?
@realm_client = realm_client
@client_scope_id = client_scope_id
end
|
Instance Method Details
#create!(mapper_representation) ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 29
def create!(mapper_representation)
execute_http do
resource(protocol_mappers_url).post(
create_payload(mapper_representation),
)
end
true
end
|
#delete(mapper_id) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 49
def delete(mapper_id)
execute_http do
resource(protocol_mappers_url(mapper_id)).delete()
end
true
end
|
#get(mapper_id) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 21
def get(mapper_id)
response = execute_http do
resource(protocol_mappers_url(mapper_id)).get()
end
ProtocolMapperRepresentation.from_hash(JSON.parse(response))
end
|
#list ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 13
def list
response = execute_http do
resource(protocol_mappers_url).get()
end
JSON.parse(response).map { |h| ProtocolMapperRepresentation.from_hash(h) }
end
|
#protocol_mappers_url(mapper_id = nil) ⇒ Object
57
58
59
60
61
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 57
def protocol_mappers_url(mapper_id = nil)
base = "#{@realm_client.realm_admin_url}/client-scopes/#{encode_segment(@client_scope_id)}/protocol-mappers/models"
mapper_id ? "#{base}/#{encode_segment(mapper_id)}" : base
end
|
#save(mapper_representation) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 39
def save(mapper_representation)
execute_http do
resource(protocol_mappers_url(mapper_representation.id)).put(
create_payload(mapper_representation),
)
end
true
end
|