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
- #clients ⇒ Auth0::Clients::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.
- #groups ⇒ Auth0::Groups::Client
- #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
- #roles ⇒ Auth0::Roles::Client
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationResponseContent
Update the details of a specific Organization, 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
267 268 269 |
# File 'lib/auth0/organizations/client.rb', line 267 def client_grants @client_grants ||= Auth0::Organizations::ClientGrants::Client.new(client: @client) end |
#clients ⇒ Auth0::Clients::Client
272 273 274 |
# File 'lib/auth0/organizations/client.rb', line 272 def clients @clients ||= Auth0::Organizations::Clients::Client.new(client: @client) end |
#connections ⇒ Auth0::Connections::Client
277 278 279 |
# File 'lib/auth0/organizations/client.rb', line 277 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 Create Your First Organization.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/auth0/organizations/client.rb', line 99 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.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/auth0/organizations/client.rb', line 205 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
282 283 284 |
# File 'lib/auth0/organizations/client.rb', line 282 def discovery_domains @discovery_domains ||= Auth0::Organizations::DiscoveryDomains::Client.new(client: @client) end |
#enabled_connections ⇒ Auth0::EnabledConnections::Client
287 288 289 |
# File 'lib/auth0/organizations/client.rb', line 287 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.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/auth0/organizations/client.rb', line 168 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.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/auth0/organizations/client.rb', line 134 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 |
#groups ⇒ Auth0::Groups::Client
302 303 304 |
# File 'lib/auth0/organizations/client.rb', line 302 def groups @groups ||= Auth0::Organizations::Groups::Client.new(client: @client) end |
#invitations ⇒ Auth0::Invitations::Client
292 293 294 |
# File 'lib/auth0/organizations/client.rb', line 292 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:
- Offset pagination
- Checkpoint pagination
Checkpoint pagination must be used if you need to retrieve more than 1000 organizations.
Checkpoint Pagination
To search by checkpoint, use the following parameters:
from: Optional id from which to start selection.take: The total number of entries to retrieve when using thefromparameter. Defaults to 50.
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.
48 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 48 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["include_totals"] = params.fetch(:include_totals, true) 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) query_params["include_client_association_for"] = params[:include_client_association_for] if params.key?(:include_client_association_for) 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) parsed_response = Auth0::Types::ListOrganizationsPaginatedResponseContent.load(response.body) [parsed_response, response] 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
297 298 299 |
# File 'lib/auth0/organizations/client.rb', line 297 def members @members ||= Auth0::Organizations::Members::Client.new(client: @client) end |
#roles ⇒ Auth0::Roles::Client
307 308 309 |
# File 'lib/auth0/organizations/client.rb', line 307 def roles @roles ||= Auth0::Organizations::Roles::Client.new(client: @client) end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationResponseContent
Update the details of a specific Organization, such as name and display name, branding options, and metadata.
239 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 |
# File 'lib/auth0/organizations/client.rb', line 239 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 = %w[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 |