Module: ToHipchat

Includes:
Methadone::CLILogging
Defined in:
lib/to_hipchat.rb,
lib/to_hipchat/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.send_data(token, room, username = "To Hipchat", data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/to_hipchat.rb', line 7

def self.send_data(token, room, username = "To Hipchat", data)
  begin
    debug "Initializing HipChat client with token " + token
    client = HipChat::Client.new(token)

    debug "Sending data to room " + room + " as username " + username
    client[room].send(username, data)
  rescue HipChat::UnknownRoom
    error "Unknown Room"
  rescue HipChat::Unauthorized
    error "Unauthorized"
  rescue HipChat::UnknownResponseCode
    error "Unknown Response Code"
  end
end