2022-12-07 03:37:33 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityLogEvent
|
2023-01-05 01:29:24 +09:00
|
|
|
attr_accessor :type, :path, :data, :timestamp
|
2022-12-09 02:27:05 +09:00
|
|
|
|
2023-01-05 01:29:24 +09:00
|
|
|
def self.from_json_string(json_string)
|
|
|
|
json = Oj.load(json_string, mode: :strict)
|
|
|
|
ActivityLogEvent.new(json['type'], json['path'], json['data'])
|
2022-12-09 02:27:05 +09:00
|
|
|
end
|
|
|
|
|
2023-01-05 01:29:24 +09:00
|
|
|
|
|
|
|
def initialize(type, path, data, timestamp = Time.now.utc.iso8601)
|
|
|
|
@type = type
|
|
|
|
@path = path
|
|
|
|
@data = data
|
2023-01-05 23:19:31 +09:00
|
|
|
@timestamp = timestamp
|
2023-01-05 01:29:24 +09:00
|
|
|
end
|
2022-12-07 03:37:33 +09:00
|
|
|
end
|