debian-mirror-gitlab/app/serializers/build_action_entity.rb

25 lines
432 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
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? && can?(request.current_user, :update_build, build)
end
end