debian-mirror-gitlab/lib/api/entities/releases/link.rb

25 lines
536 B
Ruby
Raw Normal View History

2020-03-09 13:42:32 +05:30
# frozen_string_literal: true
module API
module Entities
module Releases
class Link < Grape::Entity
expose :id
expose :name
expose :url
2020-04-08 14:13:33 +05:30
expose :direct_asset_url
2020-03-09 13:42:32 +05:30
expose :external?, as: :external
2020-04-08 14:13:33 +05:30
def direct_asset_url
return object.url unless object.filepath
release = object.release
project = release.project
Gitlab::Routing.url_helpers.project_release_url(project, release) << object.filepath
end
2020-03-09 13:42:32 +05:30
end
end
end
end