Class: Smplkit::Audit::AuditEvent

Inherits:
Struct
  • Object
show all
Defined in:
lib/smplkit/audit/events.rb

Overview

Public-facing audit event resource. ADR-047 ยง2.3.1.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def action
  @action
end

#actor_idObject

Returns the value of attribute actor_id

Returns:

  • (Object)

    the current value of actor_id



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def actor_id
  @actor_id
end

#actor_labelObject

Returns the value of attribute actor_label

Returns:

  • (Object)

    the current value of actor_label



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def actor_label
  @actor_label
end

#actor_typeObject

Returns the value of attribute actor_type

Returns:

  • (Object)

    the current value of actor_type



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def actor_type
  @actor_type
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def created_at
  @created_at
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def data
  @data
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def id
  @id
end

#idempotency_keyObject

Returns the value of attribute idempotency_key

Returns:

  • (Object)

    the current value of idempotency_key



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def idempotency_key
  @idempotency_key
end

#occurred_atObject

Returns the value of attribute occurred_at

Returns:

  • (Object)

    the current value of occurred_at



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def occurred_at
  @occurred_at
end

#resource_idObject

Returns the value of attribute resource_id

Returns:

  • (Object)

    the current value of resource_id



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def resource_id
  @resource_id
end

#resource_typeObject

Returns the value of attribute resource_type

Returns:

  • (Object)

    the current value of resource_type



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def resource_type
  @resource_type
end

#snapshotObject

Returns the value of attribute snapshot

Returns:

  • (Object)

    the current value of snapshot



116
117
118
# File 'lib/smplkit/audit/events.rb', line 116

def snapshot
  @snapshot
end

Class Method Details

.from_resource(resource) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/smplkit/audit/events.rb', line 123

def self.from_resource(resource)
  attrs = resource.attributes
  new(
    id: resource.id,
    action: attrs.action,
    resource_type: attrs.resource_type,
    resource_id: attrs.resource_id,
    occurred_at: attrs.occurred_at,
    created_at: attrs.created_at,
    actor_type: attrs.actor_type,
    actor_id: attrs.actor_id,
    actor_label: attrs.actor_label,
    snapshot: attrs.snapshot,
    data: attrs.data || {},
    idempotency_key: attrs.idempotency_key
  )
end