Class: Igniter::Extensions::Contracts::Audit::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/extensions/contracts/audit/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_id:, type:, node_name:, path:, status:, payload: {}) ⇒ Event

Returns a new instance of Event.



10
11
12
13
14
15
16
17
18
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 10

def initialize(event_id:, type:, node_name:, path:, status:, payload: {})
  @event_id = event_id.to_s
  @type = type.to_sym
  @node_name = node_name.to_sym
  @path = Array(path).map(&:to_sym).freeze
  @status = status.to_sym
  @payload = payload.freeze
  freeze
end

Instance Attribute Details

#event_idObject (readonly)

Returns the value of attribute event_id.



8
9
10
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 8

def event_id
  @event_id
end

#node_nameObject (readonly)

Returns the value of attribute node_name.



8
9
10
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 8

def node_name
  @node_name
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 8

def path
  @path
end

#payloadObject (readonly)

Returns the value of attribute payload.



8
9
10
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 8

def payload
  @payload
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 8

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 8

def type
  @type
end

Instance Method Details

#to_hObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/igniter/extensions/contracts/audit/event.rb', line 20

def to_h
  {
    event_id: event_id,
    type: type,
    node_name: node_name,
    path: path,
    status: status,
    payload: payload
  }
end