BigW Consortium Gitlab

build_artifact_entity.rb 592 Bytes
Newer Older
1
class BuildArtifactEntity < Grape::Entity
2 3
  include RequestAwareEntity

Z.J. van de Weg committed
4 5
  expose :name do |job|
    job.name
6 7
  end

Z.J. van de Weg committed
8 9 10 11
  expose :artifacts_expired?, as: :expired
  expose :artifacts_expire_at, as: :expire_at

  expose :path do |job|
12
    download_project_job_artifacts_path(project, job)
13
  end
Z.J. van de Weg committed
14 15

  expose :keep_path, if: -> (*) { job.has_expiring_artifacts? } do |job|
16
    keep_project_job_artifacts_path(project, job)
Z.J. van de Weg committed
17 18 19
  end

  expose :browse_path do |job|
20
    browse_project_job_artifacts_path(project, job)
Z.J. van de Weg committed
21 22 23 24 25 26 27 28 29
  end

  private

  alias_method :job, :object

  def project
    job.project
  end
30
end