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

34 lines
676 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class BuildArtifactEntity < Grape::Entity
include RequestAwareEntity
include GitlabRoutingHelper
2017-05-29 03:58:20 -04:00
expose :name do |job|
job.name
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|
fast_download_project_job_artifacts_path(project, job)
end
2017-05-29 03:58:20 -04:00
expose :keep_path, if: -> (*) { job.has_expiring_archive_artifacts? } do |job|
fast_keep_project_job_artifacts_path(project, job)
2017-05-29 03:58:20 -04:00
end
expose :browse_path do |job|
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
end