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



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def action
  @action
end

#actor_idObject

Returns the value of attribute actor_id

Returns:

  • (Object)

    the current value of actor_id



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def actor_id
  @actor_id
end

#actor_labelObject

Returns the value of attribute actor_label

Returns:

  • (Object)

    the current value of actor_label



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def actor_label
  @actor_label
end

#actor_typeObject

Returns the value of attribute actor_type

Returns:

  • (Object)

    the current value of actor_type



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def actor_type
  @actor_type
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def created_at
  @created_at
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def data
  @data
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def id
  @id
end

#idempotency_keyObject

Returns the value of attribute idempotency_key

Returns:

  • (Object)

    the current value of idempotency_key



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def idempotency_key
  @idempotency_key
end

#occurred_atObject

Returns the value of attribute occurred_at

Returns:

  • (Object)

    the current value of occurred_at



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def occurred_at
  @occurred_at
end

#resource_idObject

Returns the value of attribute resource_id

Returns:

  • (Object)

    the current value of resource_id



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def resource_id
  @resource_id
end

#resource_typeObject

Returns the value of attribute resource_type

Returns:

  • (Object)

    the current value of resource_type



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def resource_type
  @resource_type
end

#snapshotObject

Returns the value of attribute snapshot

Returns:

  • (Object)

    the current value of snapshot



96
97
98
# File 'lib/smplkit/audit/events.rb', line 96

def snapshot
  @snapshot
end

Class Method Details

.from_resource(resource) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/smplkit/audit/events.rb', line 103

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