Class: Courier::Resources::AuditEvents

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

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:



52
53
54
# File 'lib/courier/resources/audit_events.rb', line 52

def initialize(client:)
  @client = client
end

Instance Method Details

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

Fetch the list of audit events

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:



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/courier/resources/audit_events.rb', line 37

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

Fetch a specific audit event by ID.

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:



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

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