Class: Courier::AsyncAuditEventsClient
- Inherits:
-
Object
- Object
- Courier::AsyncAuditEventsClient
- Defined in:
- lib/trycourier/audit_events/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
-
#get(audit_event_id:, request_options: nil) ⇒ AuditEvents::AuditEvent
Fetch a specific audit event by ID.
- #initialize(request_client:) ⇒ AsyncAuditEventsClient constructor
-
#list(cursor: nil, request_options: nil) ⇒ AuditEvents::ListAuditEventsResponse
Fetch the list of audit events.
Constructor Details
#initialize(request_client:) ⇒ AsyncAuditEventsClient
60 61 62 63 |
# File 'lib/trycourier/audit_events/client.rb', line 60 def initialize(request_client:) # @type [AsyncRequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
56 57 58 |
# File 'lib/trycourier/audit_events/client.rb', line 56 def request_client @request_client end |
Instance Method Details
#get(audit_event_id:, request_options: nil) ⇒ AuditEvents::AuditEvent
Fetch a specific audit event by ID.
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/trycourier/audit_events/client.rb', line 90 def get(audit_event_id:, request_options: nil) Async do response = @request_client.conn.get("/audit-events/#{audit_event_id}") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact end AuditEvents::AuditEvent.from_json(json_object: response.body) end end |
#list(cursor: nil, request_options: nil) ⇒ AuditEvents::ListAuditEventsResponse
Fetch the list of audit events
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/trycourier/audit_events/client.rb', line 70 def list(cursor: nil, request_options: nil) Async do response = @request_client.conn.get("/audit-events") do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? unless &..nil? req.headers["Authorization"] = . end req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "cursor": cursor }.compact end AuditEvents::ListAuditEventsResponse.from_json(json_object: response.body) end end |