2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
class BuildArtifactEntity < Grape::Entity
|
|
|
|
include RequestAwareEntity
|
2020-03-09 13:42:32 +05:30
|
|
|
include GitlabRoutingHelper
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expose :name do |job|
|
|
|
|
job.name
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expose :artifacts_expired?, as: :expired
|
|
|
|
expose :artifacts_expire_at, as: :expire_at
|
|
|
|
|
|
|
|
expose :path do |job|
|
2020-03-09 13:42:32 +05:30
|
|
|
fast_download_project_job_artifacts_path(project, job)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
expose :keep_path, if: -> (*) { job.has_expiring_archive_artifacts? } do |job|
|
|
|
|
fast_keep_project_job_artifacts_path(project, job)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
expose :browse_path do |job|
|
2020-03-09 13:42:32 +05:30
|
|
|
fast_browse_project_job_artifacts_path(project, job)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
alias_method :job, :object
|
|
|
|
|
|
|
|
def project
|
|
|
|
job.project
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|