Class: Courier::Resources::AuditEvents

Inherits:
Object
  • Object
show all
Defined in:
lib/courier/resources/audit_events.rb,
sig/courier/resources/audit_events.rbs

Overview

Read the audit trail of configuration and access changes in your workspace.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AuditEvents

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AuditEvents.

Parameters:



55
56
57
# File 'lib/courier/resources/audit_events.rb', line 55

def initialize(client:)
  @client = client
end

Instance Method Details

#list(cursor: nil, request_options: {}) ⇒ Courier::Models::AuditEventListResponse

Returns the workspace's audit event log with cursor paging. Each event records the actor, target, source, type, and timestamp of a change.

Parameters:

  • cursor (String, nil)

    A unique identifier that allows for fetching the next set of audit events.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/courier/resources/audit_events.rb', line 40

def list(params = {})
  parsed, options = Courier::AuditEventListParams.dump_request(params)
  query = Courier::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "audit-events",
    query: query,
    model: Courier::Models::AuditEventListResponse,
    options: options
  )
end

#retrieve(audit_event_id, request_options: {}) ⇒ Courier::Models::AuditEvent

Returns one audit event by id, including the actor who performed it, the target they changed, the source, the event type, and a timestamp.

Parameters:

  • audit_event_id (String)

    A unique identifier associated with the audit event you wish to retrieve

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



19
20
21
22
23
24
25
26
# File 'lib/courier/resources/audit_events.rb', line 19

def retrieve(audit_event_id, params = {})
  @client.request(
    method: :get,
    path: ["audit-events/%1$s", audit_event_id],
    model: Courier::AuditEvent,
    options: params[:request_options]
  )
end