Class: Merge::Ats::AsyncAuditTrailClient

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/audit_trail/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Merge::Ats::AsyncAuditTrailClient

Parameters:



94
95
96
# File 'lib/merge_ruby_client/ats/audit_trail/client.rb', line 94

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::AsyncRequestClient (readonly)



90
91
92
# File 'lib/merge_ruby_client/ats/audit_trail/client.rb', line 90

def request_client
  @request_client
end

Instance Method Details

#list(cursor: nil, end_date: nil, event_type: nil, page_size: nil, start_date: nil, user_email: nil, request_options: nil) ⇒ Merge::Ats::PaginatedAuditLogEventList

Gets a list of audit trail events.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.audit_trail.list

Parameters:

  • cursor (String) (defaults to: nil)

    The pagination cursor value.

  • end_date (String) (defaults to: nil)

    If included, will only include audit trail events that occurred before this time

  • event_type (String) (defaults to: nil)

    If included, will only include events with the given event type. Possible values include: ‘CREATED_REMOTE_PRODUCTION_API_KEY`, `DELETED_REMOTE_PRODUCTION_API_KEY`, `CREATED_TEST_API_KEY`, `DELETED_TEST_API_KEY`, `REGENERATED_PRODUCTION_API_KEY`, `INVITED_USER`, `TWO_FACTOR_AUTH_ENABLED`, `TWO_FACTOR_AUTH_DISABLED`, `DELETED_LINKED_ACCOUNT`, `CREATED_DESTINATION`, `DELETED_DESTINATION`, `CHANGED_DESTINATION`, `CHANGED_SCOPES`, `CHANGED_PERSONAL_INFORMATION`, `CHANGED_ORGANIZATION_SETTINGS`, `ENABLED_INTEGRATION`, `DISABLED_INTEGRATION`, `ENABLED_CATEGORY`, `DISABLED_CATEGORY`, `CHANGED_PASSWORD`, `RESET_PASSWORD`, `ENABLED_REDACT_UNMAPPED_DATA_FOR_ORGANIZATION`, `ENABLED_REDACT_UNMAPPED_DATA_FOR_LINKED_ACCOUNT`, `DISABLED_REDACT_UNMAPPED_DATA_FOR_ORGANIZATION`, `DISABLED_REDACT_UNMAPPED_DATA_FOR_LINKED_ACCOUNT`, `CREATED_INTEGRATION_WIDE_FIELD_MAPPING`, `CREATED_LINKED_ACCOUNT_FIELD_MAPPING`, `CHANGED_INTEGRATION_WIDE_FIELD_MAPPING`, `CHANGED_LINKED_ACCOUNT_FIELD_MAPPING`, `DELETED_INTEGRATION_WIDE_FIELD_MAPPING`, `DELETED_LINKED_ACCOUNT_FIELD_MAPPING`, `FORCED_LINKED_ACCOUNT_RESYNC`, `MUTED_ISSUE`, `GENERATED_MAGIC_LINK`, `ENABLED_MERGE_WEBHOOK`, `DISABLED_MERGE_WEBHOOK`, `MERGE_WEBHOOK_TARGET_CHANGED`, `END_USER_CREDENTIALS_ACCESSED`

  • page_size (Integer) (defaults to: nil)

    Number of results to return per page.

  • start_date (String) (defaults to: nil)

    If included, will only include audit trail events that occurred after this time

  • user_email (String) (defaults to: nil)

    If provided, this will return events associated with the specified user email. Please note that the email address reflects the user’s email at the time of the event, and may not be their current email.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/merge_ruby_client/ats/audit_trail/client.rb', line 138

def list(cursor: nil, end_date: nil, event_type: nil, page_size: nil, start_date: nil, user_email: nil,
         request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "cursor": cursor,
        "end_date": end_date,
        "event_type": event_type,
        "page_size": page_size,
        "start_date": start_date,
        "user_email": user_email
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/audit-trail"
    end
    Merge::Ats::PaginatedAuditLogEventList.from_json(json_object: response.body)
  end
end