class KeycloakAdmin::RealmClient

Public Class Methods

new(configuration, realm_name=nil) click to toggle source
Calls superclass method KeycloakAdmin::Client::new
# File lib/keycloak-admin/client/realm_client.rb, line 3
def initialize(configuration, realm_name=nil)
  super(configuration)
  @realm_name = realm_name
end

Public Instance Methods

clients() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 66
def clients
  ClientClient.new(@configuration, self)
end
configurable_token() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 62
def configurable_token
  ConfigurableTokenClient.new(@configuration, self)
end
delete() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 15
def delete
  execute_http do
    RestClient::Resource.new(realm_admin_url, @configuration.rest_client_options).delete(headers)
  end
  true
end
group(group_id) click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 74
def group(group_id)
  GroupResource.new(@configuration, self, group_id)
end
groups() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 70
def groups
  GroupClient.new(@configuration, self)
end
list() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 8
def list
  response = execute_http do
    RestClient::Resource.new(realm_list_url, @configuration.rest_client_options).get(headers)
  end
  JSON.parse(response).map { |realm_as_hash| RealmRepresentation.from_hash(realm_as_hash) }
end
name_defined?() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 90
def name_defined?
  !@realm_name.nil?
end
realm_admin_url() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 46
def realm_admin_url
  if @realm_name
    "#{server_url}/admin/realms/#{@realm_name}"
  else
    "#{server_url}/admin/realms"
  end
end
realm_list_url() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 54
def realm_list_url
  "#{server_url}/admin/realms"
end
realm_url() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 38
def realm_url
  if @realm_name
    "#{server_url}/realms/#{@realm_name}"
  else
    "#{server_url}/realms"
  end
end
roles() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 78
def roles
  RoleClient.new(@configuration, self)
end
save(realm_representation) click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 22
def save(realm_representation)
  execute_http do
    RestClient::Resource.new(realm_list_url, @configuration.rest_client_options).post(
      realm_representation.to_json, headers
    )
  end
end
token() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 58
def token
  TokenClient.new(@configuration, self)
end
update(realm_representation_body) click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 30
def update(realm_representation_body)
  execute_http do
    RestClient::Resource.new(realm_admin_url, @configuration.rest_client_options).put(
      realm_representation_body.to_json, headers
    )
  end
end
user(user_id) click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 86
def user(user_id)
  UserResource.new(@configuration, self, user_id)
end
users() click to toggle source
# File lib/keycloak-admin/client/realm_client.rb, line 82
def users
  UserClient.new(@configuration, self)
end