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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
# frozen_string_literal: true
module ActivityPub
class ReleaseEntity < Grape::Entity
include RequestAwareEntity
expose :id do |release, opts|
"#{opts[:url]}##{release.tag}"
end
expose :type do |*|
"Create"
end
expose :to do |*|
'https://www.w3.org/ns/activitystreams#Public'
end
expose :author, as: :actor, using: UserEntity
expose :object do
expose :id do |release|
project_release_url(release.project, release)
end
expose :type do |*|
"Application"
end
expose :name
expose :url do |release|
project_release_url(release.project, release)
end
expose :description, as: :content
expose :project, as: :context, using: ProjectEntity
end
end
end
|