Class: WorkOS::Radar
- Inherits:
-
Object
- Object
- WorkOS::Radar
- Defined in:
- lib/workos/radar.rb
Instance Method Summary collapse
-
#add_list_entry(type:, action:, entry:, request_options: {}) ⇒ WorkOS::RadarListEntryAlreadyPresentResponse
Add an entry to a Radar list.
-
#create_attempt(ip_address:, user_agent:, email:, auth_method:, action:, request_options: {}) ⇒ WorkOS::RadarStandaloneResponse
Create an attempt.
-
#initialize(client) ⇒ Radar
constructor
A new instance of Radar.
-
#remove_list_entry(type:, action:, entry:, request_options: {}) ⇒ void
Remove an entry from a Radar list.
-
#update_attempt(id:, challenge_status: nil, attempt_status: nil, request_options: {}) ⇒ void
Update a Radar attempt.
Constructor Details
#initialize(client) ⇒ Radar
Returns a new instance of Radar.
9 10 11 |
# File 'lib/workos/radar.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#add_list_entry(type:, action:, entry:, request_options: {}) ⇒ WorkOS::RadarListEntryAlreadyPresentResponse
Add an entry to a Radar list
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/workos/radar.rb', line 80 def add_list_entry( type:, action:, entry:, request_options: {} ) body = { "entry" => entry } response = @client.request( method: :post, path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", auth: true, body: body, request_options: ) result = WorkOS::RadarListEntryAlreadyPresentResponse.new(response.body) result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#create_attempt(ip_address:, user_agent:, email:, auth_method:, action:, request_options: {}) ⇒ WorkOS::RadarStandaloneResponse
Create an attempt
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/workos/radar.rb', line 21 def create_attempt( ip_address:, user_agent:, email:, auth_method:, action:, request_options: {} ) body = { "ip_address" => ip_address, "user_agent" => user_agent, "email" => email, "auth_method" => auth_method, "action" => action } response = @client.request( method: :post, path: "/radar/attempts", auth: true, body: body, request_options: ) result = WorkOS::RadarStandaloneResponse.new(response.body) result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#remove_list_entry(type:, action:, entry:, request_options: {}) ⇒ void
This method returns an undefined value.
Remove an entry from a Radar list
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/workos/radar.rb', line 107 def remove_list_entry( type:, action:, entry:, request_options: {} ) body = { "entry" => entry } @client.request( method: :delete, path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", auth: true, body: body, request_options: ) nil end |
#update_attempt(id:, challenge_status: nil, attempt_status: nil, request_options: {}) ⇒ void
This method returns an undefined value.
Update a Radar attempt
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/workos/radar.rb', line 54 def update_attempt( id:, challenge_status: nil, attempt_status: nil, request_options: {} ) body = { "challenge_status" => challenge_status, "attempt_status" => attempt_status }.compact @client.request( method: :put, path: "/radar/attempts/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: ) nil end |