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



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def action
  @action
end

#actor_idObject

Returns the value of attribute actor_id

Returns:

  • (Object)

    the current value of actor_id



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def actor_id
  @actor_id
end

#actor_labelObject

Returns the value of attribute actor_label

Returns:

  • (Object)

    the current value of actor_label



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def actor_label
  @actor_label
end

#actor_typeObject

Returns the value of attribute actor_type

Returns:

  • (Object)

    the current value of actor_type



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def actor_type
  @actor_type
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def created_at
  @created_at
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def data
  @data
end

#do_not_forwardObject

Returns the value of attribute do_not_forward

Returns:

  • (Object)

    the current value of do_not_forward



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def do_not_forward
  @do_not_forward
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def id
  @id
end

#idempotency_keyObject

Returns the value of attribute idempotency_key

Returns:

  • (Object)

    the current value of idempotency_key



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def idempotency_key
  @idempotency_key
end

#occurred_atObject

Returns the value of attribute occurred_at

Returns:

  • (Object)

    the current value of occurred_at



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def occurred_at
  @occurred_at
end

#resource_idObject

Returns the value of attribute resource_id

Returns:

  • (Object)

    the current value of resource_id



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def resource_id
  @resource_id
end

#resource_typeObject

Returns the value of attribute resource_type

Returns:

  • (Object)

    the current value of resource_type



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def resource_type
  @resource_type
end

#snapshotObject

Returns the value of attribute snapshot

Returns:

  • (Object)

    the current value of snapshot



118
119
120
# File 'lib/smplkit/audit/events.rb', line 118

def snapshot
  @snapshot
end

Class Method Details

.from_resource(resource) ⇒ Object



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

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,
    do_not_forward: attrs.do_not_forward || false
  )
end