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
Jérome Perrin
gitlab-ce
Commits
fd232084
Commit
fd232084
authored
Oct 08, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1650 from NARKOZ/api
API for project snippets listing
parents
5501955d
61f12da3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
5 deletions
+36
-5
CHANGELOG
CHANGELOG
+8
-3
doc/api/snippets.md
doc/api/snippets.md
+9
-1
lib/api/projects.rb
lib/api/projects.rb
+10
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+9
-0
No files found.
CHANGELOG
View file @
fd232084
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
...
...
doc/api/snippets.md
View file @
fd232084
## 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
...
...
lib/api/projects.rb
View file @
fd232084
...
@@ -176,7 +176,6 @@ module Gitlab
...
@@ -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
...
@@ -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:
...
...
spec/requests/api/projects_spec.rb
View file @
fd232084
...
@@ -220,6 +220,15 @@ describe Gitlab::API do
...
@@ -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
)
...
...
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