diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-21 11:46:45 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-21 11:46:45 +0300 |
commit | c624b45bd01591f31b63f6c94599d08f2f27c652 (patch) | |
tree | 2248800dc1c74cf93be40c95b96630f38efe2a04 /lib/api | |
parent | 72abe9f679043a1ac566f60109b21cadace204d7 (diff) | |
parent | 62b322d7b567f1fae2ea8b5a3b0e71a62506e47d (diff) | |
download | gitlab-ce-c624b45bd01591f31b63f6c94599d08f2f27c652.tar.gz |
Merge branch 'hipchat_api' of https://github.com/qwazerty/gitlabhq into qwazerty-hipchat_api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
CHANGELOG
Diffstat (limited to 'lib/api')
-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 - |