debian-mirror-gitlab/lib/api/entities/compare.rb

30 lines
643 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module API
module Entities
class Compare < Grape::Entity
expose :commit, using: Entities::Commit do |compare, _|
compare.commits.last
end
expose :commits, using: Entities::Commit do |compare, _|
compare.commits
end
expose :diffs, using: Entities::Diff do |compare, _|
compare.diffs.diffs.to_a
end
expose :compare_timeout do |compare, _|
compare.diffs.diffs.overflow?
end
expose :same, as: :compare_same_ref
2021-11-11 11:23:49 +05:30
expose :web_url do |compare, _|
Gitlab::UrlBuilder.build(compare)
end
2020-03-13 15:44:24 +05:30
end
end
end