Class: WorkOS::AuditLogEvent

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/audit_logs/audit_log_event.rb

Constant Summary collapse

HASH_ATTRS =
{
  action: :action,
  occurred_at: :occurred_at,
  actor: :actor,
  targets: :targets,
  context: :context,
  metadata: :metadata,
  version: :version
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

normalize

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ AuditLogEvent

Returns a new instance of AuditLogEvent.



26
27
28
29
30
31
32
33
34
35
# File 'lib/workos/audit_logs/audit_log_event.rb', line 26

def initialize(json)
  hash = self.class.normalize(json)
  @action = hash[:action]
  @occurred_at = hash[:occurred_at]
  @actor = hash[:actor] ? WorkOS::AuditLogEventActor.new(hash[:actor]) : nil
  @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogEventTarget.new(item) : nil }
  @context = hash[:context] ? WorkOS::AuditLogEventContext.new(hash[:context]) : nil
  @metadata = hash[:metadata] || {}
  @version = hash[:version]
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def action
  @action
end

#actorObject

Returns the value of attribute actor.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def actor
  @actor
end

#contextObject

Returns the value of attribute context.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def context
  @context
end

#metadataObject

Returns the value of attribute metadata.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def 
  @metadata
end

#occurred_atObject

Returns the value of attribute occurred_at.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def occurred_at
  @occurred_at
end

#targetsObject

Returns the value of attribute targets.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def targets
  @targets
end

#versionObject

Returns the value of attribute version.



17
18
19
# File 'lib/workos/audit_logs/audit_log_event.rb', line 17

def version
  @version
end