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
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
release = object.release.present
|
|
|
|
release.download_url(object.filepath)
|
2020-04-08 14:13:33 +05:30
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|