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



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

def action
  @action
end

#actor_idObject

Returns the value of attribute actor_id

Returns:

  • (Object)

    the current value of actor_id



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

def actor_id
  @actor_id
end

#actor_labelObject

Returns the value of attribute actor_label

Returns:

  • (Object)

    the current value of actor_label



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

def actor_label
  @actor_label
end

#actor_typeObject

Returns the value of attribute actor_type

Returns:

  • (Object)

    the current value of actor_type



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

def actor_type
  @actor_type
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



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

def created_at
  @created_at
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



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

def data
  @data
end

#do_not_forwardObject

Returns the value of attribute do_not_forward

Returns:

  • (Object)

    the current value of do_not_forward



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

def do_not_forward
  @do_not_forward
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



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

def id
  @id
end

#idempotency_keyObject

Returns the value of attribute idempotency_key

Returns:

  • (Object)

    the current value of idempotency_key



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

def idempotency_key
  @idempotency_key
end

#occurred_atObject

Returns the value of attribute occurred_at

Returns:

  • (Object)

    the current value of occurred_at



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

def occurred_at
  @occurred_at
end

#resource_idObject

Returns the value of attribute resource_id

Returns:

  • (Object)

    the current value of resource_id



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

def resource_id
  @resource_id
end

#resource_typeObject

Returns the value of attribute resource_type

Returns:

  • (Object)

    the current value of resource_type



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

def resource_type
  @resource_type
end

Class Method Details

.from_resource(resource) ⇒ Object



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

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,
    data: Smplkit::Helpers.deep_stringify_keys(attrs.data || {}),
    idempotency_key: attrs.idempotency_key,
    do_not_forward: attrs.do_not_forward || false
  )
end