debian-mirror-gitlab/app/serializers/integrations/harbor_serializers/artifact_entity.rb
2022-08-13 15:12:31 +05:30

29 lines
577 B
Ruby

# 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