Class: Auth0::Organizations::DiscoveryDomains::Client
- Inherits:
-
Object
- Object
- Auth0::Organizations::DiscoveryDomains::Client
- Defined in:
- lib/auth0/organizations/discovery_domains/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateOrganizationDiscoveryDomainResponseContent
Create a new discovery domain for an organization.
-
#delete(request_options: {}, **params) ⇒ untyped
Remove a discovery domain from an organization.
-
#get(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationDiscoveryDomainResponseContent
Retrieve details about a single organization discovery domain specified by ID.
-
#get_by_name(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationDiscoveryDomainByNameResponseContent
Retrieve details about a single organization discovery domain specified by domain name.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Auth0::Types::ListOrganizationDiscoveryDomainsResponseContent
Retrieve list of all organization discovery domains associated with the specified organization.
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationDiscoveryDomainResponseContent
Update the verification status and/or use_for_organization_discovery for an organization discovery domain.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateOrganizationDiscoveryDomainResponseContent
Create a new discovery domain for an organization.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 90 def create(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Organizations::DiscoveryDomains::Types::CreateOrganizationDiscoveryDomainRequestContent.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: "POST", path: "organizations/#{URI.encode_uri_component(params[:id].to_s)}/discovery-domains", 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) (response.body.to_s.empty? ? nil : Auth0::Types::CreateOrganizationDiscoveryDomainResponseContent.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 a discovery domain from an organization. This action cannot be undone.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 222 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)}/discovery-domains/#{URI.encode_uri_component(params[:discovery_domain_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 |
#get(request_options: {}, **params) ⇒ Auth0::Types::GetOrganizationDiscoveryDomainResponseContent
Retrieve details about a single organization discovery domain specified by ID. This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 181 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)}/discovery-domains/#{URI.encode_uri_component(params[:discovery_domain_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) (response.body.to_s.empty? ? nil : Auth0::Types::GetOrganizationDiscoveryDomainResponseContent.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::GetOrganizationDiscoveryDomainByNameResponseContent
Retrieve details about a single organization discovery domain specified by domain name. This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 138 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/#{URI.encode_uri_component(params[:id].to_s)}/discovery-domains/name/#{URI.encode_uri_component(params[:discovery_domain].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) (response.body.to_s.empty? ? nil : Auth0::Types::GetOrganizationDiscoveryDomainByNameResponseContent.load(response.body)) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Auth0::Types::ListOrganizationDiscoveryDomainsResponseContent
Retrieve list of all organization discovery domains associated with the specified organization. This endpoint is subject to eventual consistency; newly created, updated, or deleted discovery domains may not immediately appear in the response.
37 38 39 40 41 42 43 44 45 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 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 37 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) Auth0::Internal::CursorItemIterator.new( cursor_field: :next_, item_field: :domains, 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/#{URI.encode_uri_component(params[:id].to_s)}/discovery-domains", 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 = (response.body.to_s.empty? ? nil : Auth0::Types::ListOrganizationDiscoveryDomainsResponseContent.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 |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateOrganizationDiscoveryDomainResponseContent
Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The
status field must be either pending or verified. The use_for_organization_discovery field can be
true or false (default: true).
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/auth0/organizations/discovery_domains/client.rb', line 263 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Organizations::DiscoveryDomains::Types::UpdateOrganizationDiscoveryDomainRequestContent.new(params).to_h non_body_param_names = %w[id discovery_domain_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)}/discovery-domains/#{URI.encode_uri_component(params[:discovery_domain_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) (response.body.to_s.empty? ? nil : Auth0::Types::UpdateOrganizationDiscoveryDomainResponseContent.load(response.body)) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |