BigW Consortium Gitlab

runner_entity.rb 356 Bytes
Newer Older
1
class RunnerEntity < Grape::Entity
2 3 4 5
  include RequestAwareEntity

  expose :id, :description

Z.J. van de Weg committed
6 7
  expose :edit_path,
    if: -> (*) { can?(request.current_user, :admin_build, project) && runner.specific? } do |runner|
8
    edit_project_runner_path(project, runner)
9 10 11 12
  end

  private

Z.J. van de Weg committed
13 14
  alias_method :runner, :object

15 16 17
  def project
    request.project
  end
18
end