Class: Merge::Accounting::AsyncAuditTrailClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:



99
100
101
# File 'lib/merge_ruby_client/accounting/audit_trail/client.rb', line 99

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::AsyncRequestClient (readonly)



95
96
97
# File 'lib/merge_ruby_client/accounting/audit_trail/client.rb', line 95

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::Accounting::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.accounting.audit_trail.list(cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw")

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`, `REGENERATED_WEBHOOK_SIGNATURE`, `INVITED_USER`, `TWO_FACTOR_AUTH_ENABLED`, `TWO_FACTOR_AUTH_DISABLED`, `DELETED_LINKED_ACCOUNT`, `DELETED_ALL_COMMON_MODELS_FOR_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`, `CREATED_LINKED_ACCOUNT_COMMON_MODEL_OVERRIDE`, `CHANGED_LINKED_ACCOUNT_COMMON_MODEL_OVERRIDE`, `DELETED_LINKED_ACCOUNT_COMMON_MODEL_OVERRIDE`, `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:



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/merge_ruby_client/accounting/audit_trail/client.rb', line 148

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)}/accounting/v1/audit-trail"
    end
    Merge::Accounting::PaginatedAuditLogEventList.from_json(json_object: response.body)
  end
end