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

build_entity.rb « serializers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 203bd747ad980edc9b2bd0a238d5963d110e6303 (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
class BuildEntity < Grape::Entity
  include RequestAwareEntity

  expose :id
  expose :name

  expose :build_url do |build|
    url_to(:namespace_project_build, build)
  end

  expose :retry_url do |build|
    url_to(:retry_namespace_project_build, build)
  end

  expose :play_url, if: ->(build, _) { build.manual? } do |build|
    url_to(:play_namespace_project_build, build)
  end

  private

  def url_to(route, build)
    @urls.send("#{route}_url", build.project.namespace, build.project, build)
  end
end