summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Medina <cabkarian@gmail.com>2015-02-05 01:42:34 +0000
committerCristian Medina <cabkarian@gmail.com>2015-04-03 04:35:12 -0400
commitf04549056806d2bcb63441ebdffe1032711e83c8 (patch)
tree545321b096d5c627b741a1f62a2c8cf85e086707
parent0d0042d27481d31027a10edb2ba3a184bff5075a (diff)
downloadgitlab-ce-f04549056806d2bcb63441ebdffe1032711e83c8.tar.gz
Modified lib/api/entities.rb to expose Project class tag_list property to the API
Updated projects.md to show tag_list field when performing GETs Updated projects_spec.rb to include check for tag_list key in project list Added changes to the CHANGELOG
-rw-r--r--CHANGELOG1
-rw-r--r--doc/api/projects.md12
-rw-r--r--lib/api/entities.rb2
-rw-r--r--spec/requests/api/projects_spec.rb9
4 files changed, 22 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c67ce17dc3b..156792a4f84 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -56,6 +56,7 @@ v 7.10.0 (unreleased)
- Fix "Hello @username." references not working by no longer allowing usernames to end in period.
- Archive repositories in background worker.
- Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
+ - Project labels are now available over the API under the "tag_list" field (Cristian Medina)
v 7.9.2
diff --git a/doc/api/projects.md b/doc/api/projects.md
index 7fe244477db..55d525fef66 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -44,6 +44,10 @@ Parameters:
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
"http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
"web_url": "http://example.com/diaspora/diaspora-client",
+ "tag_list": [
+ "example",
+ "disapora client"
+ ],
"owner": {
"id": 3,
"name": "Diaspora",
@@ -80,6 +84,10 @@ Parameters:
"ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
"http_url_to_repo": "http://example.com/brightbox/puppet.git",
"web_url": "http://example.com/brightbox/puppet",
+ "tag_list": [
+ "example",
+ "puppet"
+ ],
"owner": {
"id": 4,
"name": "Brightbox",
@@ -163,6 +171,10 @@ Parameters:
"ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
"http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
"web_url": "http://example.com/diaspora/diaspora-project-site",
+ "tag_list": [
+ "example",
+ "disapora project"
+ ],
"owner": {
"id": 3,
"name": "Diaspora",
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 489be210784..51cb934616b 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -46,7 +46,7 @@ module API
end
class Project < Grape::Entity
- expose :id, :description, :default_branch
+ expose :id, :description, :default_branch, :tag_list
expose :public?, as: :public
expose :archived?, as: :archived
expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index b713f1fe898..cc387378d3a 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -57,7 +57,14 @@ describe API::API, api: true do
expect(json_response.first['name']).to eq(project.name)
expect(json_response.first['owner']['username']).to eq(user.username)
end
-
+
+ it 'should include the project labels as the tag_list' do
+ get api('/projects', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.first.keys.should include('tag_list')
+ end
+
context 'and using search' do
it 'should return searched project' do
get api('/projects', user), { search: project.name }