Commit c1a5f471 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #8645 from chulkilee/hipchat-api-version

Add api version property on hipchat service
parents bc9ba523 57c72455
class Projects::ServicesController < Projects::ApplicationController
ALLOWED_PARAMS = [:title, :token, :type, :active, :api_key, :subdomain,
ALLOWED_PARAMS = [:title, :token, :type, :active, :api_key, :api_version, :subdomain,
:room, :recipients, :project_url, :webhook,
:user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
:build_key, :server, :teamcity_url, :build_type,
......
......@@ -20,7 +20,7 @@
class HipchatService < Service
MAX_COMMITS = 3
prop_accessor :token, :room, :server, :notify, :color
prop_accessor :token, :room, :server, :notify, :color, :api_version
validates :token, presence: true, if: :activated?
def title
......@@ -41,6 +41,8 @@ class HipchatService < Service
{ type: 'text', name: 'room', placeholder: 'Room name or ID' },
{ type: 'checkbox', name: 'notify' },
{ type: 'select', name: 'color', choices: ['yellow', 'red', 'green', 'purple', 'gray', 'random'] },
{ type: 'text', name: 'api_version',
placeholder: 'Leave blank for default (v2)' },
{ type: 'text', name: 'server',
placeholder: 'Leave blank for default. https://hipchat.example.com' }
]
......@@ -60,7 +62,7 @@ class HipchatService < Service
private
def gate
options = { api_version: 'v2' }
options = { api_version: api_version || 'v2' }
options[:server_url] = server unless server.blank?
@gate ||= HipChat::Client.new(token, options)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment