summaryrefslogtreecommitdiff
path: root/app/serializers/deployment_entity.rb
blob: e493c9162fd6a1a1a3a58915f5fde0c1d5f8a9ca (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
class DeploymentEntity < Grape::Entity
  include RequestAwareEntity

  expose :id
  expose :iid
  expose :sha

  expose :ref do
    expose :name do |deployment|
      deployment.ref
    end

    expose :ref_path do |deployment|
      namespace_project_tree_path(
        deployment.project.namespace,
        deployment.project,
        id: deployment.ref)
    end
  end

  expose :created_at
  expose :tag
  expose :last?

  expose :user, using: UserEntity
  expose :commit, using: CommitEntity
  expose :deployable, using: JobEntity
  expose :manual_actions, using: JobEntity
end