Class: HipChat::NotifyRoom

Inherits:
Chef::Handler
  • Object
show all
Defined in:
lib/hipchat/chef.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_token, room_name, notify_users = false) ⇒ NotifyRoom

Returns a new instance of NotifyRoom.



18
19
20
21
22
# File 'lib/hipchat/chef.rb', line 18

def initialize(api_token, room_name, notify_users=false)
  @api_token = api_token
  @room_name = room_name
  @notify_users = notify_users
end

Instance Method Details

#reportObject



24
25
26
27
28
29
# File 'lib/hipchat/chef.rb', line 24

def report
  msg = "Failure on #{node.name}: #{run_status.formatted_exception}"

  client = HipChat::Client.new(@api_token)
  client[@room_name].send('Chef', msg, :notify => @notify_users)
end