2016-12-21 08:51:53 -05:00
|
|
|
class BuildActionEntity < Grape::Entity
|
2016-11-10 09:32:23 -05:00
|
|
|
include RequestAwareEntity
|
|
|
|
|
|
|
|
expose :name do |build|
|
2017-01-01 09:04:30 -05:00
|
|
|
build.name
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|
|
|
|
|
2016-12-21 08:47:20 -05:00
|
|
|
expose :path do |build|
|
2017-05-16 07:41:15 -04:00
|
|
|
play_namespace_project_job_path(
|
2016-11-10 11:50:55 -05:00
|
|
|
build.project.namespace,
|
|
|
|
build.project,
|
2016-11-10 09:32:23 -05:00
|
|
|
build)
|
|
|
|
end
|
2017-03-17 12:25:17 -04:00
|
|
|
|
|
|
|
expose :playable?, as: :playable
|
2017-04-06 11:16:19 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
alias_method :build, :object
|
|
|
|
|
|
|
|
def playable?
|
2017-05-09 00:15:34 -04:00
|
|
|
build.playable? && can?(request.current_user, :update_build, build)
|
2017-04-06 11:16:19 -04:00
|
|
|
end
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|