Commit fd2320849f07071258ec045b414fe2baa0dea9da
Exists in
master
and in
4 other branches
Merge pull request #1650 from NARKOZ/api
API for project snippets listing
Showing
4 changed files
with
36 additions
and
5 deletions
Show diff stats
CHANGELOG
1 | +master | |
2 | + - [API] add project snippets list | |
3 | + - [API] allow to authorize using private token in HTTP header | |
4 | + - [API] add user creation | |
5 | + | |
1 | 6 | v 2.9.1 |
2 | 7 | - Fixed resque custom config init |
3 | 8 | |
... | ... | @@ -9,7 +14,7 @@ v 2.9.0 |
9 | 14 | - restyled projects list on dashboard |
10 | 15 | - ssh keys validation to prevent gitolite crash |
11 | 16 | - send notifications if changed premission in project |
12 | - - scss refactoring. gitlab_bootstrap/ dir | |
17 | + - scss refactoring. gitlab_bootstrap/ dir | |
13 | 18 | - fix git push http body bigger than 112k problem |
14 | 19 | - list of labels page under issues tab |
15 | 20 | - API for milestones, keys |
... | ... | @@ -113,7 +118,7 @@ v 2.1.0 |
113 | 118 | v 2.0.0 |
114 | 119 | - gitolite as main git host system |
115 | 120 | - merge requests |
116 | - - project/repo access | |
121 | + - project/repo access | |
117 | 122 | - link to commit/issue feed |
118 | 123 | - design tab |
119 | 124 | - improved email notifications |
... | ... | @@ -147,7 +152,7 @@ v 1.1.0 |
147 | 152 | - bugfix & code cleaning |
148 | 153 | |
149 | 154 | v 1.0.2 |
150 | - - fixed bug with empty project | |
155 | + - fixed bug with empty project | |
151 | 156 | - added adv validation for project path & code |
152 | 157 | - feature: issues can be sortable |
153 | 158 | - bugfix | ... | ... |
doc/api/snippets.md
lib/api/projects.rb
... | ... | @@ -176,7 +176,6 @@ module Gitlab |
176 | 176 | authorize! :admin_project, user_project |
177 | 177 | @hook = user_project.hooks.find(params[:hook_id]) |
178 | 178 | @hook.destroy |
179 | - nil | |
180 | 179 | end |
181 | 180 | |
182 | 181 | # Get a project repository branches |
... | ... | @@ -229,6 +228,16 @@ module Gitlab |
229 | 228 | present CommitDecorator.decorate(commits), with: Entities::RepoCommit |
230 | 229 | end |
231 | 230 | |
231 | + # Get a project snippets | |
232 | + # | |
233 | + # Parameters: | |
234 | + # id (required) - The ID or code name of a project | |
235 | + # Example Request: | |
236 | + # GET /projects/:id/snippets | |
237 | + get ":id/snippets" do | |
238 | + present paginate(user_project.snippets), with: Entities::ProjectSnippet | |
239 | + end | |
240 | + | |
232 | 241 | # Get a project snippet |
233 | 242 | # |
234 | 243 | # Parameters: | ... | ... |
spec/requests/api/projects_spec.rb
... | ... | @@ -220,6 +220,15 @@ describe Gitlab::API do |
220 | 220 | end |
221 | 221 | end |
222 | 222 | |
223 | + describe "GET /projects/:id/snippets" do | |
224 | + it "should return a project snippet" do | |
225 | + get api("/projects/#{project.code}/snippets", user) | |
226 | + response.status.should == 200 | |
227 | + json_response.should be_an Array | |
228 | + json_response.first['title'].should == snippet.title | |
229 | + end | |
230 | + end | |
231 | + | |
223 | 232 | describe "GET /projects/:id/snippets/:snippet_id" do |
224 | 233 | it "should return a project snippet" do |
225 | 234 | get api("/projects/#{project.code}/snippets/#{snippet.id}", user) | ... | ... |