Class: Auth0::Anomaly::Blocks::Client
- Inherits:
-
Object
- Object
- Auth0::Anomaly::Blocks::Client
- Defined in:
- lib/auth0/anomaly/blocks/client.rb
Instance Method Summary collapse
-
#check_ip(request_options: {}, **params) ⇒ untyped
Check if the given IP address is blocked via the <a href=“auth0.com/docs/configure/attack-protection/suspicious-ip-throttling”>Suspicious IP Throttling</a> due to multiple suspicious attempts.
- #initialize(client:) ⇒ void constructor
-
#unblock_ip(request_options: {}, **params) ⇒ untyped
Remove a block imposed by <a href=“auth0.com/docs/configure/attack-protection/suspicious-ip-throttling”>Suspicious IP Throttling</a> for the given IP address.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/auth0/anomaly/blocks/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#check_ip(request_options: {}, **params) ⇒ untyped
Check if the given IP address is blocked via the <a href=“auth0.com/docs/configure/attack-protection/suspicious-ip-throttling”>Suspicious IP Throttling</a> due to multiple suspicious attempts.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/auth0/anomaly/blocks/client.rb', line 28 def check_ip(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "anomaly/blocks/ips/#{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 |
#unblock_ip(request_options: {}, **params) ⇒ untyped
Remove a block imposed by <a href=“auth0.com/docs/configure/attack-protection/suspicious-ip-throttling”>Suspicious IP Throttling</a> for the given IP address.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/auth0/anomaly/blocks/client.rb', line 62 def unblock_ip(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "anomaly/blocks/ips/#{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 |