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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
62b322d7
Commit
62b322d7
authored
Oct 14, 2014
by
Kevin Houdebert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Hipchat services API
parent
e3bd17a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
2 deletions
+109
-2
CHANGELOG
CHANGELOG
+1
-0
doc/api/services.md
doc/api/services.md
+46
-0
lib/api/services.rb
lib/api/services.rb
+36
-2
spec/requests/api/services_spec.rb
spec/requests/api/services_spec.rb
+26
-0
No files found.
CHANGELOG
View file @
62b322d7
...
@@ -27,6 +27,7 @@ v 7.4.0
...
@@ -27,6 +27,7 @@ v 7.4.0
- New milestone and label links on issue edit form
- New milestone and label links on issue edit form
- Improved repository graphs
- Improved repository graphs
- Improve event note display in dashboard and project activity views (Vinnie Okada)
- Improve event note display in dashboard and project activity views (Vinnie Okada)
- API: Add support for Hipchat (Kevin Houdebert)
v 7.3.2
v 7.3.2
- Fix creating new file via web editor
- Fix creating new file via web editor
...
...
doc/api/services.md
0 → 100644
View file @
62b322d7
# Services
## GitLab CI
### Edit GitLab CI service
Set GitLab CI service for a project.
```
PUT /projects/:id/services/gitlab-ci
```
Parameters:
-
`token`
(required) - CI project token
-
`project_url`
(required) - CI project url
### Delete GitLab CI service
Delete GitLab CI service settings for a project.
```
DELETE /projects/:id/services/gitlab-ci
```
## Hipchat
### Edit Hipchat service
Set Hipchat service for project.
```
PUT /projects/:id/services/hipchat
```
Parameters:
-
`token`
(required) - Hipchat token
-
`room`
(required) - Hipchat room name
### Delete Hipchat service
Delete Hipchat service for a project.
```
DELETE /projects/:id/services/hipchat
```
lib/api/services.rb
View file @
62b322d7
...
@@ -28,7 +28,7 @@ module API
...
@@ -28,7 +28,7 @@ module API
# Delete GitLab CI service settings
# Delete GitLab CI service settings
#
#
# Example Request:
# Example Request:
# DELETE /projects/:id/
keys/:id
# DELETE /projects/:id/
services/gitlab-ci
delete
":id/services/gitlab-ci"
do
delete
":id/services/gitlab-ci"
do
if
user_project
.
gitlab_ci_service
if
user_project
.
gitlab_ci_service
user_project
.
gitlab_ci_service
.
update_attributes
(
user_project
.
gitlab_ci_service
.
update_attributes
(
...
@@ -38,7 +38,41 @@ module API
...
@@ -38,7 +38,41 @@ module API
)
)
end
end
end
end
# Set Hipchat service for project
#
# Parameters:
# token (required) - Hipchat token
# room (required) - Hipchat room name
#
# Example Request:
# PUT /projects/:id/services/hipchat
put
':id/services/hipchat'
do
required_attributes!
[
:token
,
:room
]
attrs
=
attributes_for_keys
[
:token
,
:room
]
user_project
.
build_missing_services
if
user_project
.
hipchat_service
.
update_attributes
(
attrs
.
merge
(
active:
true
))
true
else
not_found!
end
end
# Delete Hipchat service settings
#
# Example Request:
# DELETE /projects/:id/services/hipchat
delete
':id/services/hipchat'
do
if
user_project
.
hipchat_service
user_project
.
hipchat_service
.
update_attributes
(
active:
false
,
token:
nil
,
room:
nil
)
end
end
end
end
end
end
end
end
spec/requests/api/services_spec.rb
View file @
62b322d7
...
@@ -27,4 +27,30 @@ describe API::API, api: true do
...
@@ -27,4 +27,30 @@ describe API::API, api: true do
project
.
gitlab_ci_service
.
should
be_nil
project
.
gitlab_ci_service
.
should
be_nil
end
end
end
end
describe
'PUT /projects/:id/services/hipchat'
do
it
'should update hipchat settings'
do
put
api
(
"/projects/
#{
project
.
id
}
/services/hipchat"
,
user
),
token:
'secret-token'
,
room:
'test'
response
.
status
.
should
==
200
project
.
hipchat_service
.
should_not
be_nil
end
it
'should return if required fields missing'
do
put
api
(
"/projects/
#{
project
.
id
}
/services/gitlab-ci"
,
user
),
token:
'secret-token'
,
active:
true
response
.
status
.
should
==
400
end
end
describe
'DELETE /projects/:id/services/hipchat'
do
it
'should delete hipchat settings'
do
delete
api
(
"/projects/
#{
project
.
id
}
/services/hipchat"
,
user
)
response
.
status
.
should
==
200
project
.
hipchat_service
.
should
be_nil
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