rubys / wave-robot-ruby-client

Wave Robot Ruby Client Library

This URL has Read+Write access

wave-robot-ruby-client / samples
100644 17 lines (15 sloc) 0.495 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'lib/waveapi/init'
 
class Robot < AbstractRobot
  set_name "Sinatra Bot"
  add_cron :clock, 20
  
  def DOCUMENT_CHANGED(properties, context)
    wavelet = context.GetWavelets[0]
    blip = context.GetBlipById(wavelet.GetRootBlipId())
    blip.GetDocument.SetText('Only I get to edit the top blip!')
  end
  def clock(event, context)
    wavelet = context.GetWavelets[0]
    blip = context.GetBlipById(wavelet.GetRootBlipId())
blip.GetDocument.SetText("It's " + Time.now.to_s)
  end
end