Class: KnifeSantoku::Notification::HipchatNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/knife_santoku/notification/hipchat_notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HipchatNotifier

Returns a new instance of HipchatNotifier.



7
8
9
10
11
12
13
14
15
16
# File 'lib/knife_santoku/notification/hipchat_notifier.rb', line 7

def initialize(config)
  @url   = "https://api.hipchat.com/v1/rooms/message"
  
  @token = config["hipchat"]["token"]
  @room  = config["hipchat"]["room"]
  @from  = config["hipchat"]["from"]
  @notify = 0 if config["hipchat"]["notify"] == false
  @notify = 1 if config["hipchat"]["notify"] == true
  @color = config["hipchat"]["color"]
end

Instance Method Details

#notify(msg) ⇒ Object



18
19
20
21
# File 'lib/knife_santoku/notification/hipchat_notifier.rb', line 18

def notify(msg)
  url = "#{@url}?format=json&auth_token=#{@token}&message=#{URI.escape(msg)}&room_id=#{@room}&from=#{@from}&notify=#{@notify}&color=#{@color}"
  HTTParty.post(url)
end