class Lita::Handlers::Hello
Public Instance Methods
example(request,response2)
click to toggle source
# File lib/lita/handlers/lita-hello.rb, line 17 def example(request,response2) `ruby /home/lita/test_lines.rb` `rsvg-convert /tmp/sq_linechart.svg -o /home/lita/robot/test.png` file=File.read("/home/lita/robot/test.png") response2["Content-Type"] = "image/png" response2.write(file) response2.finish p "/kkr#{$id}.png" end
hyper(response)
click to toggle source
# File lib/lita/handlers/lita-hello.rb, line 64 def hyper(response) response.reply("ihello") end
imagery(response)
click to toggle source
# File lib/lita/handlers/lita-hello.rb, line 56 def imagery(response) response.reply("http://#{config.lita_public_ip}:9000/kkr#{$id}.png") $id=rand(100) end
index(response)
click to toggle source
# File lib/lita/handlers/lita-hello.rb, line 34 def index(response) if response.matches[0]=="hey" and ! response.matches[0].is_a?Array response.reply("Please enter hey <counter_group_id>") end conn = "tcp://demo.trisul.org:12006" tint = TRP::TimeInterval.new() tint.to= TRP::Timestamp.new({:tv_sec=>Time.now.tv_sec}) tint.from= TRP::Timestamp.new() tint.from.tv_sec = tint.to.tv_sec - 3600 req = TrisulRP::Protocol.mk_request(TRP::Message::Command::COUNTER_GROUP_TOPPER_REQUEST,{:counter_group=>response.matches[0][0],:meter=>0,:maxitems=>2,time_interval:tint}) TrisulRP::Protocol.get_response_zmq(config.query_endpoint,req) do |resp| resp.keys.each do |key| response.reply("#{key.label}=#{key.metric*300}") end end end