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.
- #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
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationResponseContent
Update the details of a specific [Organization](auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), 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
263 264 265 |
# File 'lib/auth0/organizations/client.rb', line 263 def client_grants @client_grants ||= Auth0::Organizations::ClientGrants::Client.new(client: @client) end |
#connections ⇒ Auth0::Connections::Client
268 269 270 |
# File 'lib/auth0/organizations/client.rb', line 268 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](auth0.com/docs/manage-users/organizations/create-first-organization).
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/auth0/organizations/client.rb', line 95 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.
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/auth0/organizations/client.rb', line 201 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
273 274 275 |
# File 'lib/auth0/organizations/client.rb', line 273 def discovery_domains @discovery_domains ||= Auth0::Organizations::DiscoveryDomains::Client.new(client: @client) end |
#enabled_connections ⇒ Auth0::EnabledConnections::Client
278 279 280 |
# File 'lib/auth0/organizations/client.rb', line 278 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.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/auth0/organizations/client.rb', line 164 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.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/auth0/organizations/client.rb', line 130 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
293 294 295 |
# File 'lib/auth0/organizations/client.rb', line 293 def groups @groups ||= Auth0::Organizations::Groups::Client.new(client: @client) end |
#invitations ⇒ Auth0::Invitations::Client
283 284 285 |
# File 'lib/auth0/organizations/client.rb', line 283 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 the `from` parameter. 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.
46 47 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 |
# File 'lib/auth0/organizations/client.rb', line 46 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) 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) 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
288 289 290 |
# File 'lib/auth0/organizations/client.rb', line 288 def members @members ||= Auth0::Organizations::Members::Client.new(client: @client) end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationResponseContent
Update the details of a specific [Organization](auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), such as name and display name, branding options, and metadata.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/auth0/organizations/client.rb', line 235 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 |