2016-12-21 08:51:53 -05:00
|
|
|
class BuildArtifactEntity < Grape::Entity
|
2016-11-10 09:32:23 -05:00
|
|
|
include RequestAwareEntity
|
|
|
|
|
2017-05-29 03:58:20 -04:00
|
|
|
expose :name do |job|
|
|
|
|
job.name
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|
|
|
|
|
2017-05-29 03:58:20 -04:00
|
|
|
expose :artifacts_expired?, as: :expired
|
|
|
|
expose :artifacts_expire_at, as: :expire_at
|
|
|
|
|
|
|
|
expose :path do |job|
|
2017-05-16 07:41:15 -04:00
|
|
|
download_namespace_project_job_artifacts_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-05-29 03:58:20 -04:00
|
|
|
|
|
|
|
expose :keep_path, if: -> (*) { job.has_expiring_artifacts? } do |job|
|
|
|
|
keep_namespace_project_job_artifacts_path(
|
|
|
|
project.namespace,
|
|
|
|
project,
|
|
|
|
build)
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :browse_path do |job|
|
|
|
|
browse_namespace_project_job_artifacts_path(
|
|
|
|
project.namespace,
|
|
|
|
project,
|
|
|
|
job)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
alias_method :job, :object
|
|
|
|
|
|
|
|
def project
|
|
|
|
job.project
|
|
|
|
end
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|