diff options
author | Kevin Houdebert <kevin@qwazerty.eu> | 2014-10-14 21:07:34 +0400 |
---|---|---|
committer | Kevin Houdebert <kevin@qwazerty.eu> | 2014-10-14 21:07:34 +0400 |
commit | 62b322d7b567f1fae2ea8b5a3b0e71a62506e47d (patch) | |
tree | 923fe5f48bd2864f7a7665ef67d574c14b5088c3 /lib/api/services.rb | |
parent | e3bd17a7ba5238c147a79d0770e8503fd913610c (diff) |
Add Hipchat services API
Diffstat (limited to 'lib/api/services.rb')
-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 - |