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
b58d85c3
Commit
b58d85c3
authored
Sep 01, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok
parent
ec2f5263
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
9 deletions
+48
-9
lib/api/entities.rb
lib/api/entities.rb
+2
-2
lib/api/users.rb
lib/api/users.rb
+37
-0
lib/api/v3/github_repos.rb
lib/api/v3/github_repos.rb
+9
-7
No files found.
lib/api/entities.rb
View file @
b58d85c3
...
...
@@ -1131,12 +1131,12 @@ module API
author:
{
name:
commit
.
author_name
,
email:
commit
.
author_email
,
date:
"2011-04-14T16:00:49Z"
date:
commit
.
authored_date
.
iso8601
(
3
)
},
committer:
{
name:
commit
.
committer_name
,
email:
commit
.
committer_email
,
date:
"2011-04-14T16:00:49Z"
#
commit.committed_date.iso8601(3)
date:
commit
.
committed_date
.
iso8601
(
3
)
},
message:
commit
.
safe_message
}
...
...
lib/api/users.rb
View file @
b58d85c3
...
...
@@ -5,6 +5,43 @@ module API
allow_access_with_scope
:read_user
,
if:
->
(
request
)
{
request
.
get?
}
resource
:users
do
get
':id'
do
present
{
"login"
=>
"oswaldo"
,
"id"
=>
1
,
"avatar_url"
=>
"https://github.com/images/error/octocat_happy.gif"
,
"gravatar_id"
=>
""
,
"url"
=>
"https://api.github.com/users/octocat"
,
"html_url"
=>
"https://github.com/octocat"
,
"followers_url"
=>
"https://api.github.com/users/octocat/followers"
,
"following_url"
=>
"https://api.github.com/users/octocat/following{/other_user}"
,
"gists_url"
=>
"https://api.github.com/users/octocat/gists{/gist_id}"
,
"starred_url"
=>
"https://api.github.com/users/octocat/starred{/owner}{/repo}"
,
"subscriptions_url"
=>
"https://api.github.com/users/octocat/subscriptions"
,
"organizations_url"
=>
"https://api.github.com/users/octocat/orgs"
,
"repos_url"
=>
"https://api.github.com/users/octocat/repos"
,
"events_url"
=>
"https://api.github.com/users/octocat/events{/privacy}"
,
"received_events_url"
=>
"https://api.github.com/users/octocat/received_events"
,
"type"
=>
"User"
,
"site_admin"
=>
false
,
"name"
=>
"monalisa octocat"
,
"company"
=>
"GitHub"
,
"blog"
=>
"https://github.com/blog"
,
"location"
=>
"San Francisco"
,
"email"
=>
"octocat@github.com"
,
"hireable"
=>
false
,
"bio"
=>
"There once was..."
,
"public_repos"
=>
2
,
"public_gists"
=>
1
,
"followers"
=>
20
,
"following"
=>
0
,
"created_at"
=>
"2008-01-14T04:33:35Z"
,
"updated_at"
=>
"2008-01-14T04:33:35Z"
}
end
end
resource
:users
,
requirements:
{
uid:
/[0-9]*/
,
id:
/[0-9]*/
}
do
before
do
authenticate_non_get!
...
...
lib/api/v3/github_repos.rb
View file @
b58d85c3
...
...
@@ -17,6 +17,10 @@ module API
resource
:users
do
get
':namespace/repos'
do
projs
=
::
API
::
Entities
::
Github
::
Repository
.
represent
(
current_user
.
authorized_projects
).
as_json
Rails
.
logger
.
info
(
"PROJS JSON:
#{
projs
}
"
)
present
paginate
(
current_user
.
authorized_projects
),
with:
::
API
::
Entities
::
Github
::
Repository
end
end
...
...
@@ -25,6 +29,7 @@ module API
requires
:namespace
,
type:
String
requires
:project
,
type:
String
end
resource
:repos
do
get
':namespace/:project/branches'
do
namespace
=
params
[
:namespace
]
...
...
@@ -49,13 +54,10 @@ module API
requires
:project
,
type:
String
end
get
':namespace/:project/commits/:sha'
do
Rails
.
logger
.
info
(
"FETCHING COMMITS FOR
#{
params
[
:namespace
]
}
/
#{
params
[
:project
]
}
[hardcoded]"
)
namespace
=
params
[
:namespace
]
project
=
params
[
:project
]
user_project
=
find_project!
(
"
#{
namespace
}
/
#{
project
}
"
)
# sent :sha HAS to match with the returned sha on commit in order to succeed
commit
=
user_project
.
commit
(
params
[
:sha
])
not_found!
'Commit'
unless
commit
...
...
@@ -67,7 +69,7 @@ module API
# hash =
# {
# "sha" => "
357fb168fc667ef07a3303e4bb528fbcb2147430
",
# "sha" => "
b0ee36f0a5356c092a5d4913f3523db93a1db565
",
# "commit" => {
# "author" => {
# "name" => "oswaksd",
...
...
@@ -79,7 +81,7 @@ module API
# "email" => "oswluizf@gmail.com",
# "date" => "2011-04-14T16:00:49Z"
# },
# "message" => "
hardcoded
GL-2",
# "message" => "
Fix all the bugs
GL-2",
# },
# "author" => {
# "login" => "oswaldo",
...
...
@@ -91,7 +93,7 @@ module API
# },
# "parents" => [
# {
# "sha" => "
357fb168fc667ef07a3303e4bb528fbcb2147430
"
# "sha" => "
e7d7eb49018d7bffa6be52586c518974778965c5
"
# }
# ],
# "files" => [
...
...
@@ -106,7 +108,7 @@ module API
# ]
# }
#present hash
#
present hash
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