debian-mirror-gitlab/app/serializers/integrations/harbor_serializers/artifact_entity.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
577 B
Ruby
Raw Normal View History

2022-08-13 15:12:31 +05:30
# frozen_string_literal: true
module Integrations
module HarborSerializers
class ArtifactEntity < Grape::Entity
include ActionView::Helpers::SanitizeHelper
expose :harbor_id do |item|
item['id']
end
expose :digest do |item|
strip_tags(item['digest'])
end
expose :size do |item|
item['size']
end
expose :push_time do |item|
item['push_time']&.to_datetime&.utc
end
expose :tags do |item|
item['tags'].map { |tag| strip_tags(tag['name']) }
end
end
end
end