debian-mirror-gitlab/app/serializers/build_artifact_entity.rb

30 lines
543 B
Ruby
Raw Normal View History

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-13 15:44:24 +05:30
include GitlabRoutingHelper
2017-08-17 22:00:37 +05:30
2020-06-23 00:09:42 +05:30
alias_method :artifact, :object
2017-09-10 17:25:29 +05:30
2020-06-23 00:09:42 +05:30
expose :name do |artifact|
"#{artifact.job.name}:#{artifact.file_type}"
2017-09-10 17:25:29 +05:30
end
2020-06-23 00:09:42 +05:30
expose :expire_at
expose :expired?, as: :expired
2017-09-10 17:25:29 +05:30
2020-06-23 00:09:42 +05:30
expose :path do |artifact|
fast_download_project_job_artifacts_path(
2021-04-29 21:17:54 +05:30
project,
2020-06-23 00:09:42 +05:30
artifact.job,
file_type: artifact.file_type
)
2017-09-10 17:25:29 +05:30
end
2021-04-29 21:17:54 +05:30
private
2017-09-10 17:25:29 +05:30
2021-04-29 21:17:54 +05:30
def project
options[:project] || artifact.project
2017-08-17 22:00:37 +05:30
end
end