Welcome to mirror list, hosted at ThFree Co, Russian Federation.

release_entity.rb « activity_pub « serializers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9e3e5397034c42961438ad274146968ce6be18ab (plain)
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