97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/sendhipchat/runner.rb', line 97
def run!
hp = HipChat::API.new(@options[:api_token])
rooms_to_id = rooms_flip(hp.rooms_list['rooms'])
rooms = rooms_to_id.keys
if !( (@options[:rooms] - rooms).empty? )
puts 'ERROR: Only these rooms exist.'
puts
rooms.each do |r|
puts r
end
puts
puts @parser
exit 1
end
msg = STDIN.read
if msg.length > 5000
puts 'ERROR: message must be <= 5000 characters'
puts
puts @parser
exit 1
end
@options[:rooms].each do |r|
hp.rooms_message(room_id=rooms_to_id[r], from=@options[:from],
message=msg, notify=@options[:notify], color=@options[:color])
end
end
|