Class: KeycloakAdmin::ClientRoleClient
- Defined in:
- lib/keycloak-admin/client/client_role_client.rb
Instance Method Summary collapse
- #clients_url(id) ⇒ Object
-
#initialize(configuration, realm_client) ⇒ ClientRoleClient
constructor
A new instance of ClientRoleClient.
- #list(client_id) ⇒ Object
Methods inherited from Client
#create_payload, #created_id, #current_token, #execute_http, #headers, #server_url
Constructor Details
#initialize(configuration, realm_client) ⇒ ClientRoleClient
Returns a new instance of ClientRoleClient.
4 5 6 7 8 |
# File 'lib/keycloak-admin/client/client_role_client.rb', line 4 def initialize(configuration, realm_client) super(configuration) raise ArgumentError.new("realm must be defined") unless realm_client.name_defined? @realm_client = realm_client end |
Instance Method Details
#clients_url(id) ⇒ Object
17 18 19 |
# File 'lib/keycloak-admin/client/client_role_client.rb', line 17 def clients_url(id) "#{@realm_client.realm_admin_url}/clients/#{encode_segment(id)}/roles" end |
#list(client_id) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/keycloak-admin/client/client_role_client.rb', line 10 def list(client_id) response = execute_http do resource(clients_url(client_id)).get(headers) end JSON.parse(response).map { |role_as_hash| RoleRepresentation.from_hash(role_as_hash) } end |