gitlab-org--gitlab-foss/app/serializers/build_artifact_entity.rb

30 lines
543 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class BuildArtifactEntity < Grape::Entity
include RequestAwareEntity
include GitlabRoutingHelper
alias_method :artifact, :object
2017-05-29 03:58:20 -04:00
expose :name do |artifact|
"#{artifact.job.name}:#{artifact.file_type}"
end
2017-05-29 03:58:20 -04:00
expose :expire_at
expose :expired?, as: :expired
2017-05-29 03:58:20 -04:00
expose :path do |artifact|
fast_download_project_job_artifacts_path(
project,
artifact.job,
file_type: artifact.file_type
)
2017-05-29 03:58:20 -04:00
end
private
def project
options[:project] || artifact.project
end
end