Class: Auth0::UserBlocks::Client
- Inherits:
-
Object
- Object
- Auth0::UserBlocks::Client
- Defined in:
- lib/auth0/user_blocks/client.rb
Instance Method Summary collapse
-
#delete(request_options: {}, **params) ⇒ untyped
Remove all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID.
-
#delete_by_identifier(request_options: {}, **params) ⇒ untyped
Remove all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given identifier (username, phone number, or email).
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Auth0::Types::ListUserBlocksResponseContent
Retrieve details of all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID.
-
#list_by_identifier(request_options: {}, **params) ⇒ Auth0::Types::ListUserBlocksByIdentifierResponseContent
Retrieve details of all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for a user with the given identifier (username, phone number, or email).
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/auth0/user_blocks/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#delete(request_options: {}, **params) ⇒ untyped
Remove all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID.
Note: This endpoint does not unblock users that were [blocked by a tenant administrator](auth0.com/docs/user-profile#block-and-unblock-a-user).
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/auth0/user_blocks/client.rb', line 152 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: "user-blocks/#{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 |
#delete_by_identifier(request_options: {}, **params) ⇒ untyped
Remove all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given identifier (username, phone number, or email).
Note: This endpoint does not unblock users that were [blocked by a tenant administrator](auth0.com/docs/user-profile#block-and-unblock-a-user).
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/auth0/user_blocks/client.rb', line 71 def delete_by_identifier(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["identifier"] = params[:identifier] if params.key?(:identifier) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "user-blocks", query: query_params, 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 |
#list(request_options: {}, **params) ⇒ Auth0::Types::ListUserBlocksResponseContent
Retrieve details of all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/auth0/user_blocks/client.rb', line 110 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["consider_brute_force_enablement"] = params[:consider_brute_force_enablement] if params.key?(:consider_brute_force_enablement) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "user-blocks/#{URI.encode_uri_component(params[:id].to_s)}", 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::ListUserBlocksResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_by_identifier(request_options: {}, **params) ⇒ Auth0::Types::ListUserBlocksByIdentifierResponseContent
Retrieve details of all [Brute-force Protection](auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for a user with the given identifier (username, phone number, or email).
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/auth0/user_blocks/client.rb', line 28 def list_by_identifier(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["identifier"] = params[:identifier] if params.key?(:identifier) query_params["consider_brute_force_enablement"] = params[:consider_brute_force_enablement] if params.key?(:consider_brute_force_enablement) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "user-blocks", 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::ListUserBlocksByIdentifierResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |