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
dcd4ea47
Commit
dcd4ea47
authored
Aug 24, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update remaining endpoints
parent
f0f3f385
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
20 deletions
+18
-20
lib/api/group_variables.rb
lib/api/group_variables.rb
+1
-2
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
lib/api/pipeline_schedules.rb
lib/api/pipeline_schedules.rb
+1
-2
lib/api/projects.rb
lib/api/projects.rb
+0
-1
lib/api/protected_branches.rb
lib/api/protected_branches.rb
+1
-3
lib/api/services.rb
lib/api/services.rb
+7
-7
lib/api/users.rb
lib/api/users.rb
+5
-2
lib/api/variables.rb
lib/api/variables.rb
+1
-0
spec/requests/api/pipeline_schedules_spec.rb
spec/requests/api/pipeline_schedules_spec.rb
+1
-2
No files found.
lib/api/group_variables.rb
View file @
dcd4ea47
...
@@ -88,8 +88,7 @@ module API
...
@@ -88,8 +88,7 @@ module API
variable
=
user_group
.
variables
.
find_by
(
key:
params
[
:key
])
variable
=
user_group
.
variables
.
find_by
(
key:
params
[
:key
])
not_found!
(
'GroupVariable'
)
unless
variable
not_found!
(
'GroupVariable'
)
unless
variable
status
204
destroy_conditionally!
(
variable
)
variable
.
destroy
end
end
end
end
end
end
...
...
lib/api/helpers.rb
View file @
dcd4ea47
...
@@ -14,7 +14,7 @@ module API
...
@@ -14,7 +14,7 @@ module API
def
check_unmodified_since!
(
last_modified
)
def
check_unmodified_since!
(
last_modified
)
if_unmodified_since
=
Time
.
parse
(
headers
[
'If-Unmodified-Since'
])
rescue
nil
if_unmodified_since
=
Time
.
parse
(
headers
[
'If-Unmodified-Since'
])
rescue
nil
if
if_unmodified_since
&&
last_modified
>
if_unmodified_since
if
if_unmodified_since
&&
last_modified
&&
last_modified
>
if_unmodified_since
render_api_error!
(
'412 Precondition Failed'
,
412
)
render_api_error!
(
'412 Precondition Failed'
,
412
)
end
end
end
end
...
...
lib/api/pipeline_schedules.rb
View file @
dcd4ea47
...
@@ -117,8 +117,7 @@ module API
...
@@ -117,8 +117,7 @@ module API
not_found!
(
'PipelineSchedule'
)
unless
pipeline_schedule
not_found!
(
'PipelineSchedule'
)
unless
pipeline_schedule
authorize!
:admin_pipeline_schedule
,
pipeline_schedule
authorize!
:admin_pipeline_schedule
,
pipeline_schedule
status
:accepted
destroy_conditionally!
(
pipeline_schedule
)
present
pipeline_schedule
.
destroy
,
with:
Entities
::
PipelineScheduleDetails
end
end
end
end
...
...
lib/api/projects.rb
View file @
dcd4ea47
require_dependency
'declarative_policy'
require_dependency
'declarative_policy'
module
API
module
API
# Projects API
class
Projects
<
Grape
::
API
class
Projects
<
Grape
::
API
include
PaginationParams
include
PaginationParams
...
...
lib/api/protected_branches.rb
View file @
dcd4ea47
...
@@ -76,9 +76,7 @@ module API
...
@@ -76,9 +76,7 @@ module API
delete
':id/protected_branches/:name'
,
requirements:
BRANCH_ENDPOINT_REQUIREMENTS
do
delete
':id/protected_branches/:name'
,
requirements:
BRANCH_ENDPOINT_REQUIREMENTS
do
protected_branch
=
user_project
.
protected_branches
.
find_by!
(
name:
params
[
:name
])
protected_branch
=
user_project
.
protected_branches
.
find_by!
(
name:
params
[
:name
])
protected_branch
.
destroy
destroy_conditionally!
(
protected_branch
)
status
204
end
end
end
end
end
end
...
...
lib/api/services.rb
View file @
dcd4ea47
...
@@ -655,15 +655,15 @@ module API
...
@@ -655,15 +655,15 @@ module API
end
end
delete
":id/services/:service_slug"
do
delete
":id/services/:service_slug"
do
service
=
user_project
.
find_or_initialize_service
(
params
[
:service_slug
].
underscore
)
service
=
user_project
.
find_or_initialize_service
(
params
[
:service_slug
].
underscore
)
# Todo: Check if this done the right way
check_unmodified_since!
(
service
.
updated_at
)
attrs
=
service_attributes
(
service
).
inject
({})
do
|
hash
,
key
|
destroy_conditionally!
(
service
)
do
hash
.
merge!
(
key
=>
nil
)
attrs
=
service_attributes
(
service
).
inject
({})
do
|
hash
,
key
|
end
hash
.
merge!
(
key
=>
nil
)
end
unless
service
.
update_attributes
(
attrs
.
merge
(
active:
false
))
unless
service
.
update_attributes
(
attrs
.
merge
(
active:
false
))
render_api_error!
(
'400 Bad Request'
,
400
)
render_api_error!
(
'400 Bad Request'
,
400
)
end
end
end
end
end
...
...
lib/api/users.rb
View file @
dcd4ea47
...
@@ -408,8 +408,11 @@ module API
...
@@ -408,8 +408,11 @@ module API
requires
:impersonation_token_id
,
type:
Integer
,
desc:
'The ID of the impersonation token'
requires
:impersonation_token_id
,
type:
Integer
,
desc:
'The ID of the impersonation token'
end
end
delete
':impersonation_token_id'
do
delete
':impersonation_token_id'
do
status
204
token
=
find_impersonation_token
find_impersonation_token
.
revoke!
destroy_conditionally!
(
token
)
do
token
.
revoke!
end
end
end
end
end
end
end
...
...
lib/api/variables.rb
View file @
dcd4ea47
...
@@ -88,6 +88,7 @@ module API
...
@@ -88,6 +88,7 @@ module API
variable
=
user_project
.
variables
.
find_by
(
key:
params
[
:key
])
variable
=
user_project
.
variables
.
find_by
(
key:
params
[
:key
])
not_found!
(
'Variable'
)
unless
variable
not_found!
(
'Variable'
)
unless
variable
# Variables don't have any timestamp. Therfore, destroy unconditionally.
status
204
status
204
variable
.
destroy
variable
.
destroy
end
end
...
...
spec/requests/api/pipeline_schedules_spec.rb
View file @
dcd4ea47
...
@@ -267,8 +267,7 @@ describe API::PipelineSchedules do
...
@@ -267,8 +267,7 @@ describe API::PipelineSchedules do
delete
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
"
,
master
)
delete
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
"
,
master
)
end
.
to
change
{
project
.
pipeline_schedules
.
count
}.
by
(
-
1
)
end
.
to
change
{
project
.
pipeline_schedules
.
count
}.
by
(
-
1
)
expect
(
response
).
to
have_http_status
(
:accepted
)
expect
(
response
).
to
have_http_status
(
204
)
expect
(
response
).
to
match_response_schema
(
'pipeline_schedule'
)
end
end
it
'responds with 404 Not Found if requesting non-existing pipeline_schedule'
do
it
'responds with 404 Not Found if requesting non-existing pipeline_schedule'
do
...
...
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