gitlab-org--gitlab-foss/app/serializers/build_action_entity.rb
2017-04-06 17:16:19 +02:00

24 lines
413 B
Ruby

class BuildActionEntity < Grape::Entity
include RequestAwareEntity
expose :name do |build|
build.name
end
expose :path do |build|
play_namespace_project_build_path(
build.project.namespace,
build.project,
build)
end
expose :playable?, as: :playable
private
alias_method :build, :object
def playable?
build.playable? && build.can_play?(request.user)
end
end