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
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
alias_method :artifact, :object
|
2017-05-29 03:58:20 -04:00
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
expose :name do |artifact|
|
|
|
|
"#{artifact.job.name}:#{artifact.file_type}"
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|
2017-05-29 03:58:20 -04:00
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
expose :expire_at
|
|
|
|
expose :expired?, as: :expired
|
2017-05-29 03:58:20 -04:00
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
expose :path do |artifact|
|
|
|
|
fast_download_project_job_artifacts_path(
|
|
|
|
artifact.project,
|
|
|
|
artifact.job,
|
|
|
|
file_type: artifact.file_type
|
|
|
|
)
|
2017-05-29 03:58:20 -04:00
|
|
|
end
|
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
expose :keep_path, if: -> (*) { artifact.expiring? } do |artifact|
|
|
|
|
fast_keep_project_job_artifacts_path(artifact.project, artifact.job)
|
|
|
|
end
|
2017-05-29 03:58:20 -04:00
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
expose :browse_path do |artifact|
|
|
|
|
fast_browse_project_job_artifacts_path(artifact.project, artifact.job)
|
2017-05-29 03:58:20 -04:00
|
|
|
end
|
2016-11-10 09:32:23 -05:00
|
|
|
end
|