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
Léo-Paul Géneau
gitlab-ce
Commits
8c37f0ff
Commit
8c37f0ff
authored
Jan 29, 2016
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing methods documentation; fix rubocop reported violation
parent
d42ced44
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
1 deletion
+36
-1
lib/api/runners.rb
lib/api/runners.rb
+36
-1
No files found.
lib/api/runners.rb
View file @
8c37f0ff
...
@@ -20,6 +20,12 @@ module API
...
@@ -20,6 +20,12 @@ module API
present
paginate
(
runners
),
with:
Entities
::
Runner
present
paginate
(
runners
),
with:
Entities
::
Runner
end
end
# Get runner's details
#
# Parameters:
# id (required) - The ID of ther runner
# Example Request:
# GET /runners/:id
get
':id'
do
get
':id'
do
runner
=
get_runner
(
params
[
:id
])
runner
=
get_runner
(
params
[
:id
])
can_show_runner?
(
runner
)
unless
current_user
.
is_admin?
can_show_runner?
(
runner
)
unless
current_user
.
is_admin?
...
@@ -27,6 +33,15 @@ module API
...
@@ -27,6 +33,15 @@ module API
present
runner
,
with:
Entities
::
RunnerDetails
present
runner
,
with:
Entities
::
RunnerDetails
end
end
# Update runner's details
#
# Parameters:
# id (required) - The ID of ther runner
# description (optional) - Runner's description
# active (optional) - Runner's status
# tag_list (optional) - Array of tags for runner
# Example Request:
# PUT /runners/:id
put
':id'
do
put
':id'
do
runner
=
get_runner
(
params
[
:id
])
runner
=
get_runner
(
params
[
:id
])
can_update_runner?
(
runner
)
unless
current_user
.
is_admin?
can_update_runner?
(
runner
)
unless
current_user
.
is_admin?
...
@@ -39,6 +54,12 @@ module API
...
@@ -39,6 +54,12 @@ module API
end
end
end
end
# Remove runner
#
# Parameters:
# id (required) - The ID of ther runner
# Example Request:
# DELETE /runners/:id
delete
':id'
do
delete
':id'
do
runner
=
get_runner
(
params
[
:id
])
runner
=
get_runner
(
params
[
:id
])
can_delete_runner?
(
runner
)
can_delete_runner?
(
runner
)
...
@@ -60,6 +81,13 @@ module API
...
@@ -60,6 +81,13 @@ module API
present
paginate
(
runners
),
with:
Entities
::
Runner
present
paginate
(
runners
),
with:
Entities
::
Runner
end
end
# Enable runner for project
#
# Parameters:
# id (required) - The ID of the project
# runner_id (required) - The ID of the runner
# Example Request:
# PUT /projects/:id/runners/:runner_id
put
':id/runners/:runner_id'
do
put
':id/runners/:runner_id'
do
runner
=
get_runner
(
params
[
:runner_id
])
runner
=
get_runner
(
params
[
:runner_id
])
can_enable_runner?
(
runner
)
can_enable_runner?
(
runner
)
...
@@ -68,6 +96,13 @@ module API
...
@@ -68,6 +96,13 @@ module API
present
runner
,
with:
Entities
::
Runner
present
runner
,
with:
Entities
::
Runner
end
end
# Disable project's runner
#
# Parameters:
# id (required) - The ID of the project
# runner_id (required) - The ID of the runner
# Example Request:
# DELETE /projects/:id/runners/:runner_id
delete
':id/runners/:runner_id'
do
delete
':id/runners/:runner_id'
do
runner_project
=
user_project
.
runner_projects
.
find_by
(
runner_id:
params
[
:runner_id
])
runner_project
=
user_project
.
runner_projects
.
find_by
(
runner_id:
params
[
:runner_id
])
not_found!
(
'Runner'
)
unless
runner_project
not_found!
(
'Runner'
)
unless
runner_project
...
@@ -125,7 +160,7 @@ module API
...
@@ -125,7 +160,7 @@ module API
def
user_can_access_runner?
(
runner
)
def
user_can_access_runner?
(
runner
)
runner
.
projects
.
inject
(
false
)
do
|
final
,
project
|
runner
.
projects
.
inject
(
false
)
do
|
final
,
project
|
final
||
=
abilities
.
allowed?
(
current_user
,
:admin_project
,
project
)
final
||
abilities
.
allowed?
(
current_user
,
:admin_project
,
project
)
end
end
end
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