diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-15 16:24:37 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-15 16:24:37 +0000 |
commit | f3de1c579e1d2993c61809dd94864a75a2aa4f94 (patch) | |
tree | 27f39f4a8786256169c4fc0c7a69ca98d52a6b77 /lib/api/entities.rb | |
parent | af1c217f9b6dea2afccd7ac2ee89e5b7cef2a8dd (diff) | |
parent | 309aee45b69888f9b51aaa0ce393a3f13b08c255 (diff) | |
download | gitlab-ce-f3de1c579e1d2993c61809dd94864a75a2aa4f94.tar.gz |
Merge branch 'add-missing-api-entities' into 'master'
Add missing api entities
Closes #23895
See merge request !7138
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 3806470ac94..232f231ddd2 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -155,10 +155,27 @@ module API expose :shared_projects, using: Entities::Project end + class RepoCommit < Grape::Entity + expose :id, :short_id, :title, :created_at + expose :parent_ids + expose :safe_message, as: :message + expose :author_name, :author_email, :authored_date + expose :committer_name, :committer_email, :committed_date + end + + class RepoCommitStats < Grape::Entity + expose :additions, :deletions, :total + end + + class RepoCommitDetail < RepoCommit + expose :stats, using: Entities::RepoCommitStats + expose :status + end + class RepoBranch < Grape::Entity expose :name - expose :commit do |repo_branch, options| + expose :commit, using: Entities::RepoCommit do |repo_branch, options| options[:project].repository.commit(repo_branch.dereferenced_target) end @@ -193,22 +210,6 @@ module API end end - class RepoCommit < Grape::Entity - expose :id, :short_id, :title, :author_name, :author_email, :created_at - expose :committer_name, :committer_email - expose :safe_message, as: :message - end - - class RepoCommitStats < Grape::Entity - expose :additions, :deletions, :total - end - - class RepoCommitDetail < RepoCommit - expose :parent_ids, :committed_date, :authored_date - expose :stats, using: Entities::RepoCommitStats - expose :status - end - class ProjectSnippet < Grape::Entity expose :id, :title, :file_name expose :author, using: Entities::UserBasic |