2018-07-19 14:43:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-21 08:51:53 -05:00
|
|
|
class BuildArtifactEntity < Grape::Entity
|
2016-11-10 09:32:23 -05:00
|
|
|
include RequestAwareEntity
|
2019-12-25 13:07:46 -05:00
|
|
|
include GitlabRoutingHelper
|
2016-11-10 09:32:23 -05:00
|
|
|
|
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|
|
2019-12-25 13:07:46 -05:00
|
|
|
fast_download_project_job_artifacts_path(project, job)
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|
2017-05-29 03:58:20 -04:00
|
|
|
|
2020-02-03 16:09:00 -05:00
|
|
|
expose :keep_path, if: -> (*) { job.has_expiring_archive_artifacts? } do |job|
|
2019-12-25 13:07:46 -05:00
|
|
|
fast_keep_project_job_artifacts_path(project, job)
|
2017-05-29 03:58:20 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
expose :browse_path do |job|
|
2019-12-25 13:07:46 -05:00
|
|
|
fast_browse_project_job_artifacts_path(project, job)
|
2017-05-29 03:58:20 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
alias_method :job, :object
|
|
|
|
|
|
|
|
def project
|
|
|
|
job.project
|
|
|
|
end
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|