This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2022-06-09 12:57:36 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::Admin::WebhookEventSerializer < ActiveModel::Serializer
|
|
|
|
def self.serializer_for(model, options)
|
|
|
|
case model.class.name
|
|
|
|
when 'Account'
|
|
|
|
REST::Admin::AccountSerializer
|
|
|
|
when 'Report'
|
|
|
|
REST::Admin::ReportSerializer
|
2023-03-27 00:14:21 -07:00
|
|
|
when 'Status'
|
|
|
|
REST::StatusSerializer
|
2022-06-09 12:57:36 -07:00
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
attributes :event, :created_at
|
|
|
|
|
|
|
|
has_one :virtual_object, key: :object
|
|
|
|
|
|
|
|
def virtual_object
|
|
|
|
object.object
|
|
|
|
end
|
|
|
|
|
|
|
|
def event
|
|
|
|
object.type
|
|
|
|
end
|
|
|
|
end
|