summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-16 10:18:32 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-16 10:18:32 +0100
commita43a218c98ba826ac9d8e0aa764d5a9341a6f64d (patch)
tree7311d58d02b22b93d379a8ee969feaa5caa276e1 /lib/api/entities.rb
parentaec9f211e534900f602e769dcdd6f69730849f92 (diff)
parent743d66e4da5c11f638d12a7f7ec6354631ee2b90 (diff)
downloadgitlab-ce-a43a218c98ba826ac9d8e0aa764d5a9341a6f64d.tar.gz
Merge branch 'releases-feature'
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb48
1 files changed, 29 insertions, 19 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 73acf66935a..d6aec03d7f5 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -95,25 +95,6 @@ module API
end
end
- class RepoTag < Grape::Entity
- expose :name
- expose :message do |repo_obj, _options|
- if repo_obj.respond_to?(:message)
- repo_obj.message
- else
- nil
- end
- end
-
- expose :commit do |repo_obj, options|
- if repo_obj.respond_to?(:commit)
- repo_obj.commit
- elsif options[:project]
- options[:project].repository.commit(repo_obj.target)
- end
- end
- end
-
class RepoObject < Grape::Entity
expose :name
@@ -341,5 +322,34 @@ module API
expose :user_oauth_applications
expose :after_sign_out_path
end
+
+ class Release < Grape::Entity
+ expose :tag, :description
+ end
+
+ class RepoTag < Grape::Entity
+ expose :name
+ expose :message do |repo_obj, _options|
+ if repo_obj.respond_to?(:message)
+ repo_obj.message
+ else
+ nil
+ end
+ end
+
+ expose :commit do |repo_obj, options|
+ if repo_obj.respond_to?(:commit)
+ repo_obj.commit
+ elsif options[:project]
+ options[:project].repository.commit(repo_obj.target)
+ end
+ end
+
+ expose :release, using: Entities::Release do |repo_obj, options|
+ if options[:project]
+ options[:project].releases.find_by(tag: repo_obj.name)
+ end
+ end
+ end
end
end