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

26 lines
562 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +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-13 15:44:24 +05:30
expose :external?, as: :external
2020-06-23 00:09:42 +05:30
expose :link_type
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-13 15:44:24 +05:30
end
end
end
end