Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
44aa6b90
Commit
44aa6b90
authored
Mar 21, 2014
by
Ábner Silva de Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added api method to return labels of a given project
parent
fb919a63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
lib/api/entities.rb
lib/api/entities.rb
+4
-0
lib/api/projects.rb
lib/api/projects.rb
+9
-0
spec/requests/api/labels_spec.rb
spec/requests/api/labels_spec.rb
+26
-0
No files found.
lib/api/entities.rb
View file @
44aa6b90
...
@@ -187,5 +187,9 @@ module API
...
@@ -187,5 +187,9 @@ module API
end
end
end
end
end
end
class
Label
<
Grape
::
Entity
expose
:name
end
end
end
end
end
lib/api/projects.rb
View file @
44aa6b90
...
@@ -215,6 +215,15 @@ module API
...
@@ -215,6 +215,15 @@ module API
@users
=
paginate
@users
@users
=
paginate
@users
present
@users
,
with:
Entities
::
User
present
@users
,
with:
Entities
::
User
end
end
# Get a labels list
#
# Example Request:
# GET /users
get
':id/labels'
do
@labels
=
user_project
.
issues_labels
present
@labels
,
with:
Entities
::
Label
end
end
end
end
end
end
end
spec/requests/api/labels_spec.rb
0 → 100644
View file @
44aa6b90
require
'spec_helper'
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project
,
:label_list
=>
"label1, label2"
)
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
describe
"GET /projects/:id/labels"
do
it
"should return project labels"
do
get
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
first
[
'name'
].
should
==
'label1'
json_response
.
last
[
'name'
].
should
==
'label2'
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment