summaryrefslogtreecommitdiff
path: root/lib/api/entities/compare.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/entities/compare.rb')
-rw-r--r--lib/api/entities/compare.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/api/entities/compare.rb b/lib/api/entities/compare.rb
new file mode 100644
index 00000000000..fe2f03db2af
--- /dev/null
+++ b/lib/api/entities/compare.rb
@@ -0,0 +1,25 @@
+# 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
+ end
+ end
+end