Module: WorkOS::AuditLogs
- Extended by:
- Client
- Defined in:
- lib/workos/audit_logs.rb
Overview
The Audit Logs module provides convenience methods for working with the WorkOS Audit Logs platform. You’ll need a valid API key.
Class Method Summary collapse
-
.create_event(organization:, event:, idempotency_key: nil) ⇒ nil
Create an Audit Log Event.
-
.create_export(organization:, range_start:, range_end:, actions: nil, actors: nil, targets: nil, actor_names: nil, actor_ids: nil) ⇒ WorkOS::AuditLogExport
Create an Export of Audit Log Events.
-
.get_export(id:) ⇒ WorkOS::AuditLogExport
Retrieves an Export of Audit Log Events.
Methods included from Client
client, delete_request, execute_request, get_request, handle_error_response, post_request, put_request, user_agent
Class Method Details
permalink .create_event(organization:, event:, idempotency_key: nil) ⇒ nil
Create an Audit Log Event.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/workos/audit_logs.rb', line 20 def create_event(organization:, event:, idempotency_key: nil) request = post_request( path: '/audit_logs/events', auth: true, idempotency_key: idempotency_key, body: { organization_id: organization, event: event, }, ) execute_request(request: request) end |
permalink .create_export(organization:, range_start:, range_end:, actions: nil, actors: nil, targets: nil, actor_names: nil, actor_ids: nil) ⇒ WorkOS::AuditLogExport
Create an Export of Audit Log Events.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/workos/audit_logs.rb', line 46 def create_export(organization:, range_start:, range_end:, actions: nil, # rubocop:disable Metrics/ParameterLists actors: nil, targets: nil, actor_names: nil, actor_ids: nil) body = { organization_id: organization, range_start: range_start, range_end: range_end, } body['actions'] = actions unless actions.nil? body['actors'] = actors unless actors.nil? body['actor_names'] = actor_names unless actor_names.nil? body['actor_ids'] = actor_ids unless actor_ids.nil? body['targets'] = targets unless targets.nil? request = post_request( path: '/audit_logs/exports', auth: true, body: body, ) response = execute_request(request: request) WorkOS::AuditLogExport.new(response.body) end |
permalink .get_export(id:) ⇒ WorkOS::AuditLogExport
Retrieves an Export of Audit Log Events
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/workos/audit_logs.rb', line 76 def get_export(id:) request = get_request( auth: true, path: "/audit_logs/exports/#{id}", ) response = execute_request(request: request) WorkOS::AuditLogExport.new(response.body) end |