Class: Auth0::Organizations::Client
- Inherits:
-
Object
- Object
- Auth0::Organizations::Client
- Defined in:
- lib/auth0/organizations/client.rb
Instance Method Summary collapse
- #client_grants ⇒ Auth0::ClientGrants::Client
- #connections ⇒ Auth0::Connections::Client
-
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateOrganizationResponseContent
Create a new Organization within your tenant.
-
#delete(request_options: {}, **params) ⇒ untyped
Remove an Organization from your tenant.
- #discovery_domains ⇒ Auth0::DiscoveryDomains::Client
- #enabled_connections ⇒ Auth0::EnabledConnections::Client
-
#get(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationResponseContent
Retrieve details about a single Organization specified by ID.
-
#get_by_name(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationByNameResponseContent
Retrieve details about a single Organization specified by name.
- #initialize(client:) ⇒ void constructor
- #invitations ⇒ Auth0::Invitations::Client
-
#list(request_options: {}, **params) ⇒ Auth0::Types::ListOrganizationsPaginatedResponseContent
Retrieve detailed list of all Organizations available in your tenant.
- #members ⇒ Auth0::Members::Client
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationResponseContent
Update the details of a specific <a href=“auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations”>Organization</a>, such as name and display name, branding options, and metadata.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/auth0/organizations/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#client_grants ⇒ Auth0::ClientGrants::Client
268 269 270 |
# File 'lib/auth0/organizations/client.rb', line 268 def client_grants @client_grants ||= Auth0::Organizations::ClientGrants::Client.new(client: @client) end |
#connections ⇒ Auth0::Connections::Client
273 274 275 |
# File 'lib/auth0/organizations/client.rb', line 273 def connections @connections ||= Auth0::Organizations::Connections::Client.new(client: @client) end |
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateOrganizationResponseContent
Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review <a href=“auth0.com/docs/manage-users/organizations/create-first-organization”>Create Your First Organization</a>.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/auth0/organizations/client.rb', line 100 def create(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "organizations", body: Auth0::Organizations::Types::CreateOrganizationRequestContent.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::CreateOrganizationResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Remove an Organization from your tenant. This action cannot be undone.
Note: Members are automatically disassociated from an Organization when it is deleted. However, this action does not delete these users from your tenant.
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/auth0/organizations/client.rb', line 206 def delete(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "organizations/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#discovery_domains ⇒ Auth0::DiscoveryDomains::Client
278 279 280 |
# File 'lib/auth0/organizations/client.rb', line 278 def discovery_domains @discovery_domains ||= Auth0::Organizations::DiscoveryDomains::Client.new(client: @client) end |
#enabled_connections ⇒ Auth0::EnabledConnections::Client
283 284 285 |
# File 'lib/auth0/organizations/client.rb', line 283 def enabled_connections @enabled_connections ||= Auth0::Organizations::EnabledConnections::Client.new(client: @client) end |
#get(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationResponseContent
Retrieve details about a single Organization specified by ID.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/auth0/organizations/client.rb', line 169 def get(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "organizations/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::GetOrganizationResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_by_name(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationByNameResponseContent
Retrieve details about a single Organization specified by name.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/auth0/organizations/client.rb', line 135 def get_by_name(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "organizations/name/#{URI.encode_uri_component(params[:name].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::GetOrganizationByNameResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#invitations ⇒ Auth0::Invitations::Client
288 289 290 |
# File 'lib/auth0/organizations/client.rb', line 288 def invitations @invitations ||= Auth0::Organizations::Invitations::Client.new(client: @client) end |
#list(request_options: {}, **params) ⇒ Auth0::Types::ListOrganizationsPaginatedResponseContent
Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations.
This endpoint supports two types of pagination: <ul> <li>Offset pagination</li> <li>Checkpoint pagination</li> </ul>
Checkpoint pagination must be used if you need to retrieve more than 1000 organizations.
<h2>Checkpoint Pagination</h2>
To search by checkpoint, use the following parameters: <ul> <li>from: Optional id from which to start selection.</li> <li>take: The total number of entries to retrieve when using the from parameter. Defaults to 50.</li> </ul>
Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/auth0/organizations/client.rb', line 49 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[from take sort] query_params = {} query_params["from"] = params[:from] if params.key?(:from) query_params["take"] = params.fetch(:take, 50) query_params["sort"] = params[:sort] if params.key?(:sort) params.except(*query_param_names) Auth0::Internal::CursorItemIterator.new( cursor_field: :next_, item_field: :organizations, initial_cursor: query_params["from"] ) do |next_cursor| query_params["from"] = next_cursor request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "organizations", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::ListOrganizationsPaginatedResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end end |
#members ⇒ Auth0::Members::Client
293 294 295 |
# File 'lib/auth0/organizations/client.rb', line 293 def members @members ||= Auth0::Organizations::Members::Client.new(client: @client) end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationResponseContent
Update the details of a specific <a href=“auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations”>Organization</a>, such as name and display name, branding options, and metadata.
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/auth0/organizations/client.rb', line 240 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Organizations::Types::UpdateOrganizationRequestContent.new(params).to_h non_body_param_names = ["id"] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "organizations/#{URI.encode_uri_component(params[:id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::UpdateOrganizationResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |