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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
61caaa8d
Commit
61caaa8d
authored
Sep 05, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define pagination params
parent
04094afc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
lib/api/github/entities.rb
lib/api/github/entities.rb
+1
-3
lib/api/v3/github.rb
lib/api/v3/github.rb
+7
-1
spec/requests/api/v3/github_spec.rb
spec/requests/api/v3/github_spec.rb
+3
-0
No files found.
lib/api/github/entities.rb
View file @
61caaa8d
...
...
@@ -16,7 +16,7 @@ module API
class
BranchCommit
<
Grape
::
Entity
expose
:id
,
as: :sha
expose
:type
do
|
model
|
expose
:type
do
|
_
|
'commit'
end
end
...
...
@@ -36,7 +36,6 @@ module API
}
end
expose
:commit
do
|
commit
|
# TODO: export to entity
{
author:
{
name:
commit
.
author_name
,
...
...
@@ -54,7 +53,6 @@ module API
}
end
expose
:parents
do
|
commit
|
# TODO: export to entity
commit
.
parent_ids
.
map
{
|
id
|
{
sha:
id
}
}
end
expose
:files
do
|
commit
|
...
...
lib/api/v3/github.rb
View file @
61caaa8d
module
API
module
V3
class
Github
<
Grape
::
API
include
PaginationParams
before
do
authenticate!
authorize_jira_user_agent!
(
request
)
authenticate!
end
helpers
do
...
...
@@ -36,6 +38,9 @@ module API
end
resource
:users
do
params
do
use
:pagination
end
get
':namespace/repos'
do
projects
=
current_user
.
authorized_projects
.
select
{
|
project
|
project
.
feature_available?
(
:jira_dev_panel_integration
)
}
projects
=
::
Kaminari
.
paginate_array
(
projects
)
...
...
@@ -50,6 +55,7 @@ module API
params
do
use
:project_full_path
use
:pagination
end
get
':namespace/:project/branches'
do
namespace
=
params
[
:namespace
]
...
...
spec/requests/api/v3/github_spec.rb
View file @
61caaa8d
...
...
@@ -50,6 +50,7 @@ describe API::V3::Github do
get
v3_api
(
'/users/foo/repos'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
2
)
...
...
@@ -81,6 +82,7 @@ describe API::V3::Github do
get
v3_api
(
'/users/foo/repos'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
licensed_project
.
id
)
end
...
...
@@ -94,6 +96,7 @@ describe API::V3::Github do
get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/branches"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
first
.
keys
).
to
contain_exactly
(
'name'
,
'commit'
)
expect
(
json_response
.
first
[
'commit'
].
keys
).
to
contain_exactly
(
'sha'
,
'type'
)
...
...
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