diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-21 10:11:13 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-21 10:11:13 +0000 |
commit | 53419bf330a91ff0be02026e48e260aa1f705890 (patch) | |
tree | 6c8fae85c77d23d5a48e10008c959540da00084c /lib | |
parent | ee068e76f334040fee7f328c67832489dd0de51a (diff) | |
parent | c624b45bd01591f31b63f6c94599d08f2f27c652 (diff) | |
download | gitlab-ce-53419bf330a91ff0be02026e48e260aa1f705890.tar.gz |
Merge branch 'qwazerty-hipchat_api' into 'master'
Add Hipchat services API
Manual merge of https://github.com/gitlabhq/gitlabhq/pull/7633
See merge request !1202
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/services.rb | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/lib/api/services.rb b/lib/api/services.rb index bde502e32e1..3ad59cf3adf 100644 --- a/lib/api/services.rb +++ b/lib/api/services.rb @@ -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 - |