summaryrefslogtreecommitdiff
path: root/app/serializers/runner_entity.rb
blob: e9999a36d8ab6c739fa8b3b1d4669330534545fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class RunnerEntity < Grape::Entity
  include RequestAwareEntity

  expose :id, :description

  expose :edit_path,
    if: -> (*) { can?(request.current_user, :admin_build, project) && runner.specific? } do |runner|
    edit_project_runner_path(project, runner)
  end

  private

  alias_method :runner, :object

  def project
    request.project
  end
end