Class: Auth0::Guardian::Factors::Client
- Inherits:
-
Object
- Object
- Auth0::Guardian::Factors::Client
- Defined in:
- lib/auth0/guardian/factors/client.rb
Instance Method Summary collapse
- #duo ⇒ Auth0::Duo::Client
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::GuardianFactor]
Retrieve details of all <a href=“auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors”>multi-factor authentication factors</a> associated with your tenant.
- #phone ⇒ Auth0::Phone::Client
- #push_notification ⇒ Auth0::PushNotification::Client
-
#set(request_options: {}, **params) ⇒ Auth0::Types::SetGuardianFactorResponseContent
Update the status (i.e., enabled or disabled) of a specific multi-factor authentication factor.
- #sms ⇒ Auth0::Sms::Client
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/auth0/guardian/factors/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#duo ⇒ Auth0::Duo::Client
102 103 104 |
# File 'lib/auth0/guardian/factors/client.rb', line 102 def duo @duo ||= Auth0::Guardian::Factors::Duo::Client.new(client: @client) end |
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::GuardianFactor]
Retrieve details of all <a href=“auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors”>multi-factor authentication factors</a> associated with your tenant.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/auth0/guardian/factors/client.rb', line 27 def list(request_options: {}, **params) Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "guardian/factors", 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 |
#phone ⇒ Auth0::Phone::Client
87 88 89 |
# File 'lib/auth0/guardian/factors/client.rb', line 87 def phone @phone ||= Auth0::Guardian::Factors::Phone::Client.new(client: @client) end |
#push_notification ⇒ Auth0::PushNotification::Client
92 93 94 |
# File 'lib/auth0/guardian/factors/client.rb', line 92 def push_notification @push_notification ||= Auth0::Guardian::Factors::PushNotification::Client.new(client: @client) end |
#set(request_options: {}, **params) ⇒ Auth0::Types::SetGuardianFactorResponseContent
Update the status (i.e., enabled or disabled) of a specific multi-factor authentication factor.
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/guardian/factors/client.rb', line 59 def set(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Guardian::Factors::Types::SetGuardianFactorRequestContent.new(params).to_h non_body_param_names = ["name"] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "guardian/factors/#{URI.encode_uri_component(params[:name].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::SetGuardianFactorResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |