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.
3
4
5
6
7
8
9
10
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 3
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
28
29
30
31
32
33
34
35
36
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 28
def create!(mapper_representation)
execute_http do
RestClient::Resource.new(protocol_mappers_url, @configuration.rest_client_options).post(
create_payload(mapper_representation),
)
end
true
end
|
#delete(mapper_id) ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 48
def delete(mapper_id)
execute_http do
RestClient::Resource.new(protocol_mappers_url(mapper_id), @configuration.rest_client_options).delete()
end
true
end
|
#get(mapper_id) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 20
def get(mapper_id)
response = execute_http do
RestClient::Resource.new(protocol_mappers_url(mapper_id), @configuration.rest_client_options).get()
end
ProtocolMapperRepresentation.from_hash(JSON.parse(response))
end
|
#list ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 12
def list
response = execute_http do
RestClient::Resource.new(protocol_mappers_url, @configuration.rest_client_options).get()
end
JSON.parse(response).map { |h| ProtocolMapperRepresentation.from_hash(h) }
end
|
#protocol_mappers_url(mapper_id = nil) ⇒ Object
56
57
58
59
60
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 56
def protocol_mappers_url(mapper_id = nil)
base = "#{@realm_client.realm_admin_url}/client-scopes/#{@client_scope_id}/protocol-mappers/models"
mapper_id ? "#{base}/#{mapper_id}" : base
end
|
#save(mapper_representation) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb', line 38
def save(mapper_representation)
execute_http do
RestClient::Resource.new(protocol_mappers_url(mapper_representation.id), @configuration.rest_client_options).put(
create_payload(mapper_representation),
)
end
true
end
|