activitypub-academy/app/lib/activity_log_event.rb

19 lines
411 B
Ruby
Raw Normal View History

# 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
@timestamp
end
end