Class: Magick::AuditLog::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/magick/audit_log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature_name, action, user_id: nil, changes: {}, metadata: {}) ⇒ Entry

Returns a new instance of Entry.



8
9
10
11
12
13
14
15
# File 'lib/magick/audit_log.rb', line 8

def initialize(feature_name, action, user_id: nil, changes: {}, metadata: {})
  @feature_name = feature_name.to_s
  @action = action.to_s
  @user_id = user_id
  @timestamp = Time.now
  @changes = changes
  @metadata = 
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



6
7
8
# File 'lib/magick/audit_log.rb', line 6

def action
  @action
end

#changesObject (readonly)

Returns the value of attribute changes.



6
7
8
# File 'lib/magick/audit_log.rb', line 6

def changes
  @changes
end

#feature_nameObject (readonly)

Returns the value of attribute feature_name.



6
7
8
# File 'lib/magick/audit_log.rb', line 6

def feature_name
  @feature_name
end

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'lib/magick/audit_log.rb', line 6

def 
  @metadata
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



6
7
8
# File 'lib/magick/audit_log.rb', line 6

def timestamp
  @timestamp
end

#user_idObject (readonly)

Returns the value of attribute user_id.



6
7
8
# File 'lib/magick/audit_log.rb', line 6

def user_id
  @user_id
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/magick/audit_log.rb', line 17

def to_h
  {
    feature_name: feature_name,
    action: action,
    user_id: user_id,
    timestamp: timestamp.iso8601,
    changes: changes,
    metadata: 
  }
end