blob: d01dead289e5fb153aa51d91bdcc0eaa58640499 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# frozen_string_literal: true
class ActivityPub::CollectionSerializer < ActiveModel::Serializer
def self.serializer_for(model, options)
return ActivityPub::ActivitySerializer if model.class.name == 'Status'
super
end
attributes :id, :type, :total_items
has_many :items, key: :ordered_items
def type
case object.type
when :ordered
'OrderedCollection'
else
'Collection'
end
end
def total_items
object.size
end
end
|