Class: Merge::Crm::AuditTrailClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Merge::Crm::AuditTrailClient

Parameters:



15
16
17
# File 'lib/merge_ruby_client/crm/audit_trail/client.rb', line 15

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::RequestClient (readonly)



11
12
13
# File 'lib/merge_ruby_client/crm/audit_trail/client.rb', line 11

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::Crm::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.crm.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:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/merge_ruby_client/crm/audit_trail/client.rb', line 59

def list(cursor: nil, end_date: nil, event_type: nil, page_size: nil, start_date: nil, user_email: nil,
         request_options: nil)
  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)}/crm/v1/audit-trail"
  end
  Merge::Crm::PaginatedAuditLogEventList.from_json(json_object: response.body)
end