module Keycloak::API::RealmResources

Public Instance Methods

create_realm(realm_rep) click to toggle source

@param realm_rep [Keycloak::Model::RealmRepresentation] realm representation @return [String] realm id

# File lib/keycloak/api/realm_resources.rb, line 9
def create_realm(realm_rep)
  res = post("#{@auth_server_url}/admin/realms/", realm_rep.to_json, headers: {content_type: :json})
  res.headers[:location].split("/")[-1]
end
delete_realm(realm) click to toggle source

@param realm [String] realm name

# File lib/keycloak/api/realm_resources.rb, line 15
def delete_realm(realm)
  url = "#{@auth_server_url}/admin/realms/#{realm}"
  delete(url)
end
find_realm(realm) click to toggle source

@param realm [String] realm name @return [Keycloak::Model::RealmRepresentation] realm representation

# File lib/keycloak/api/realm_resources.rb, line 29
def find_realm(realm)
  url = "#{@auth_server_url}/admin/realms/#{realm}"
  Keycloak::Model::RealmRepresentation.new JSON.parse(get(url))
end
update_realm(realm, realm_rep) click to toggle source

@param realm [String] realm name @param realm_rep [Keycloak::Model::RealmRepresentation] realm representation

# File lib/keycloak/api/realm_resources.rb, line 22
def update_realm(realm, realm_rep)
  url = "#{@auth_server_url}/admin/realms/#{realm}"
  put(url, realm_rep.to_json, headers: {content_type: :json})
end