Class: SiriSays::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/siri_says.rb

Class Method Summary collapse

Class Method Details

.run(username, password, interval = 5) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/siri_says.rb', line 34

def run( username, password, interval=5 )
  @username = username
  @password = password
  @calendar_name = "sirisays"
  
  while true
    self.ranges.each do |range|
      GCal4Ruby::Event.find( self.service, @calendar_name, {
        "start-min" => range[:start],
        "start-max" => range[:end]
      }).each do |event|
        next if range[:all_day] != event.all_day
        SiriSays::Plugins.handle( event.title )
        event.delete
      end
    end
    sleep interval
  end
end