summaryrefslogtreecommitdiff
path: root/lib/api/entities/commit_signature.rb
blob: b523227352197eadf712e77fc0639806658798bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module API
  module Entities
    class CommitSignature < Grape::Entity
      expose :signature_type
      expose :signature, merge: true do |commit, options|
        if commit.signature.is_a?(GpgSignature)
          ::API::Entities::GpgCommitSignature.represent commit.signature, options
        elsif commit.signature.is_a?(X509CommitSignature)
          ::API::Entities::X509Signature.represent commit.signature, options
        end
      end
    end
  end
end