Skip to content

Commit

Permalink
Merge 389c375 into c3efe73
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhuber committed Mar 29, 2017
2 parents c3efe73 + 389c375 commit ef61ec5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -399,6 +399,12 @@ Color of the message. Default : 'red'.

Message will appear from this nickname. Default : 'Exception'.

##### server_url

*String, optional*

Custom Server URL for self-hosted, Enterprise HipChat Server

For all options & possible values see [Hipchat API](https://www.hipchat.com/docs/api/method/rooms/message).

### IRC notifier
Expand Down
1 change: 1 addition & 0 deletions lib/exception_notifier/hipchat_notifier.rb
Expand Up @@ -13,6 +13,7 @@ def initialize(options)
opts = {
:api_version => options.delete(:api_version) || 'v1'
}
opts[:server_url] = options.delete(:server_url) if options[:server_url]
@from = options.delete(:from) || 'Exception'
@room = HipChat::Client.new(api_token, opts)[room_name]
@message_template = options.delete(:message_template) || ->(exception, errors_count) {
Expand Down
14 changes: 14 additions & 0 deletions test/exception_notifier/hipchat_notifier_test.rb
Expand Up @@ -175,6 +175,20 @@ class HipchatNotifierTest < ActiveSupport::TestCase
hipchat.call(fake_exception)
end

test "should allow server_url value (for a self-hosted HipChat Server) if set" do
options = {
:api_token => 'good_token',
:room_name => 'room_name',
:api_version => 'v2',
:server_url => 'https://domain.com',
}

HipChat::Client.stubs(:new).with('good_token', {:api_version => 'v2', :server_url => 'https://domain.com'}).returns({})

hipchat = ExceptionNotifier::HipchatNotifier.new(options)
hipchat.call(fake_exception)
end

private

def fake_body
Expand Down

0 comments on commit ef61ec5

Please sign in to comment.