Merge pull request #1650 from NARKOZ/api
API for project snippets listing
This commit is contained in:
commit
fd2320849f
11
CHANGELOG
11
CHANGELOG
|
@ -1,3 +1,8 @@
|
||||||
|
master
|
||||||
|
- [API] add project snippets list
|
||||||
|
- [API] allow to authorize using private token in HTTP header
|
||||||
|
- [API] add user creation
|
||||||
|
|
||||||
v 2.9.1
|
v 2.9.1
|
||||||
- Fixed resque custom config init
|
- Fixed resque custom config init
|
||||||
|
|
||||||
|
@ -9,7 +14,7 @@ v 2.9.0
|
||||||
- restyled projects list on dashboard
|
- restyled projects list on dashboard
|
||||||
- ssh keys validation to prevent gitolite crash
|
- ssh keys validation to prevent gitolite crash
|
||||||
- send notifications if changed premission in project
|
- send notifications if changed premission in project
|
||||||
- scss refactoring. gitlab_bootstrap/ dir
|
- scss refactoring. gitlab_bootstrap/ dir
|
||||||
- fix git push http body bigger than 112k problem
|
- fix git push http body bigger than 112k problem
|
||||||
- list of labels page under issues tab
|
- list of labels page under issues tab
|
||||||
- API for milestones, keys
|
- API for milestones, keys
|
||||||
|
@ -113,7 +118,7 @@ v 2.1.0
|
||||||
v 2.0.0
|
v 2.0.0
|
||||||
- gitolite as main git host system
|
- gitolite as main git host system
|
||||||
- merge requests
|
- merge requests
|
||||||
- project/repo access
|
- project/repo access
|
||||||
- link to commit/issue feed
|
- link to commit/issue feed
|
||||||
- design tab
|
- design tab
|
||||||
- improved email notifications
|
- improved email notifications
|
||||||
|
@ -147,7 +152,7 @@ v 1.1.0
|
||||||
- bugfix & code cleaning
|
- bugfix & code cleaning
|
||||||
|
|
||||||
v 1.0.2
|
v 1.0.2
|
||||||
- fixed bug with empty project
|
- fixed bug with empty project
|
||||||
- added adv validation for project path & code
|
- added adv validation for project path & code
|
||||||
- feature: issues can be sortable
|
- feature: issues can be sortable
|
||||||
- bugfix
|
- bugfix
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
## List snippets
|
## List snippets
|
||||||
|
|
||||||
Not implemented.
|
Get a list of project snippets.
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /projects/:id/snippets
|
||||||
|
```
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
+ `id` (required) - The ID or code name of a project
|
||||||
|
|
||||||
## Single snippet
|
## Single snippet
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,6 @@ module Gitlab
|
||||||
authorize! :admin_project, user_project
|
authorize! :admin_project, user_project
|
||||||
@hook = user_project.hooks.find(params[:hook_id])
|
@hook = user_project.hooks.find(params[:hook_id])
|
||||||
@hook.destroy
|
@hook.destroy
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get a project repository branches
|
# Get a project repository branches
|
||||||
|
@ -229,6 +228,16 @@ module Gitlab
|
||||||
present CommitDecorator.decorate(commits), with: Entities::RepoCommit
|
present CommitDecorator.decorate(commits), with: Entities::RepoCommit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get a project snippets
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# id (required) - The ID or code name of a project
|
||||||
|
# Example Request:
|
||||||
|
# GET /projects/:id/snippets
|
||||||
|
get ":id/snippets" do
|
||||||
|
present paginate(user_project.snippets), with: Entities::ProjectSnippet
|
||||||
|
end
|
||||||
|
|
||||||
# Get a project snippet
|
# Get a project snippet
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
|
|
|
@ -220,6 +220,15 @@ describe Gitlab::API do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "GET /projects/:id/snippets" do
|
||||||
|
it "should return a project snippet" do
|
||||||
|
get api("/projects/#{project.code}/snippets", user)
|
||||||
|
response.status.should == 200
|
||||||
|
json_response.should be_an Array
|
||||||
|
json_response.first['title'].should == snippet.title
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "GET /projects/:id/snippets/:snippet_id" do
|
describe "GET /projects/:id/snippets/:snippet_id" do
|
||||||
it "should return a project snippet" do
|
it "should return a project snippet" do
|
||||||
get api("/projects/#{project.code}/snippets/#{snippet.id}", user)
|
get api("/projects/#{project.code}/snippets/#{snippet.id}", user)
|
||||||
|
|
Loading…
Reference in a new issue