Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
62b322d7
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
62b322d7
编写于
10月 14, 2014
作者:
K
Kevin Houdebert
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Hipchat services API
上级
e3bd17a7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
109 addition
and
2 deletion
+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
未找到文件。
CHANGELOG
浏览文件 @
62b322d7
...
...
@@ -27,6 +27,7 @@ v 7.4.0
- New milestone and label links on issue edit form
- Improved repository graphs
- Improve event note display in dashboard and project activity views (Vinnie Okada)
- API: Add support for Hipchat (Kevin Houdebert)
v 7.3.2
- Fix creating new file via web editor
...
...
doc/api/services.md
0 → 100644
浏览文件 @
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
浏览文件 @
62b322d7
...
...
@@ -28,7 +28,7 @@ module API
# Delete GitLab CI service settings
#
# Example Request:
# DELETE /projects/:id/
keys/:id
# DELETE /projects/:id/
services/gitlab-ci
delete
":id/services/gitlab-ci"
do
if
user_project
.
gitlab_ci_service
user_project
.
gitlab_ci_service
.
update_attributes
(
...
...
@@ -38,7 +38,41 @@ module API
)
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
spec/requests/api/services_spec.rb
浏览文件 @
62b322d7
...
...
@@ -27,4 +27,30 @@ describe API::API, api: true do
project
.
gitlab_ci_service
.
should
be_nil
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录