Created
December 21, 2012 01:30
-
-
Save courtenay/4350099 to your computer and use it in GitHub Desktop.
Revisions
-
courtenay created this gist
Dec 21, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ def hipchat_hook(data, payload, log) notify_hipchat data, "[Tender] \"#{payload['discussion']['title']}\" has been #{payload['number'] > 1 ? 'updated' : 'opened'} by #{payload['author_name']}", payload['discussion']['html_href'] end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ module Tender module Hooks module HipchatCommand class << self attr_accessor :hook_command_key, :hook_command_options end self.hook_command_key = 'hipchat' self.hook_command_options = { :description => '— HipChat', :href => 'http://www.hipchat.com/', :name => 'Hipchat', :fields => { 'token' => 'Your secret API token', 'room_name' => 'The name of the room to talk into (optional, needs full API key)', 'room_id' => 'The ID of the room (optional, use this OR room name)', 'color' => 'Choose a color for your message (yellow, red, green, purple, random)' }} def notify_hipchat(data, message, href) connection = Hipchat::Client.new(data['token']) if !data['room_id'].blank? connection.room(data['room_id']).send('Tender', message + " " + "<a href=\"#{href}\">#{href}</a>", false, data['color']) elsif data['room_name'] connection[data['room_name']].send('Tender', message + " " + "<a href=\"#{href}\">#{href}</a>", false, data['color']) end end end end end