gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/serializers/rest/admin/webhook_event_serializer.rb

27 lines
472 B
Ruby
Raw Normal View History

# 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
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