mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
19 lines
401 B
Ruby
19 lines
401 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AssetSyncTokenSerializer < ActiveModel::Serializer
|
|
include Rails.application.routes.url_helpers
|
|
|
|
attributes :url, :asset_id, :filename, :token, :asset_id, :version_token, :checksum
|
|
|
|
def checksum
|
|
object.asset.file.checksum
|
|
end
|
|
|
|
def url
|
|
asset_sync_download_url(asset_id: object.asset)
|
|
end
|
|
|
|
def filename
|
|
object.asset.file.filename
|
|
end
|
|
end
|