summaryrefslogtreecommitdiff
path: root/app/serializers/build_action_entity.rb
blob: 301b718d06000af44d91bd882015fac63268b30d (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 BuildActionEntity < Grape::Entity
  include RequestAwareEntity

  expose :name do |build|
    build.name
  end

  expose :path do |build|
    play_namespace_project_job_path(
      build.project.namespace,
      build.project,
      build)
  end

  expose :playable?, as: :playable

  private

  alias_method :build, :object

  def playable?
    build.playable? && can?(request.current_user, :update_build, build)
  end
end