Add api version property on hipchat service
This commit is contained in:
parent
bb8c1cadf3
commit
57c724558d
2 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
class Projects::ServicesController < Projects::ApplicationController
|
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,
|
:room, :recipients, :project_url, :webhook,
|
||||||
:user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
|
:user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
|
||||||
:build_key, :server, :teamcity_url, :build_type,
|
:build_key, :server, :teamcity_url, :build_type,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
class HipchatService < Service
|
class HipchatService < Service
|
||||||
MAX_COMMITS = 3
|
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?
|
validates :token, presence: true, if: :activated?
|
||||||
|
|
||||||
def title
|
def title
|
||||||
|
@ -41,6 +41,8 @@ class HipchatService < Service
|
||||||
{ type: 'text', name: 'room', placeholder: 'Room name or ID' },
|
{ type: 'text', name: 'room', placeholder: 'Room name or ID' },
|
||||||
{ type: 'checkbox', name: 'notify' },
|
{ type: 'checkbox', name: 'notify' },
|
||||||
{ type: 'select', name: 'color', choices: ['yellow', 'red', 'green', 'purple', 'gray', 'random'] },
|
{ 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',
|
{ type: 'text', name: 'server',
|
||||||
placeholder: 'Leave blank for default. https://hipchat.example.com' }
|
placeholder: 'Leave blank for default. https://hipchat.example.com' }
|
||||||
]
|
]
|
||||||
|
@ -60,7 +62,7 @@ class HipchatService < Service
|
||||||
private
|
private
|
||||||
|
|
||||||
def gate
|
def gate
|
||||||
options = { api_version: 'v2' }
|
options = { api_version: api_version || 'v2' }
|
||||||
options[:server_url] = server unless server.blank?
|
options[:server_url] = server unless server.blank?
|
||||||
@gate ||= HipChat::Client.new(token, options)
|
@gate ||= HipChat::Client.new(token, options)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue