views:

137

answers:

1

I'm trying to work out how to use the icalendar ruby gem, found at:

http://icalendar.rubyforge.org/

According to their tutorial, you do something like:

  cal.event.do
# ...other event properties
alarm do
  action        "EMAIL"
  description   "This is an event reminder" # email body (required)
  summary       "Alarm notification"        # email subject (required)
  attendees     %w(mailto:[email protected] mailto:[email protected]) # one or more email recipients (required)
  add_attendee  "mailto:[email protected]"
  remove_attendee "mailto:[email protected]"
  trigger       "-PT15M" # 15 minutes before
  add_attach    "ftp://host.com/novo-procs/felizano.exe", {"FMTTYPE" => "application/binary"} # email attachments (optional)
end

alarm do
  action        "DISPLAY" # This line isn't necessary, it's the default
  summary       "Alarm notification"
  trigger       "-P1DT0H0M0S" # 1 day before
end

alarm do
  action        "AUDIO"
  trigger       "-PT15M"
  add_attach    "Basso", {"VALUE" => ["URI"]}  # only one attach allowed (optional)
end

So, I am doing something similar in my code.

  def schedule_event
    puts "Scheduling an event for " + self.title + " at " + self.start_time
      start = self.start_time
      endt = self.start_time
      title = self.title
      desc = self.description
      chan = self.channel.name
      # Create a calendar with an event (standard method)
       cal = Calendar.new
      cal.event do
        dtstart       Program.convertToDate(start)
        dtend         Program.convertToDate(endt)
        summary     "Want to watch" + title + "on: " + chan + " at: " + start
        description  desc
        klass       "PRIVATE"
        alarm do
          action        "EMAIL"
          description   desc # email body (required)
          summary       "Want to watch" + title + "on: " + chan + " at: " + start     # email subject (required)
          attendees     %w(mailto:[email protected]) # one or more email recipients (required)
          trigger       "-PT25M" # 25 minutes before
        end

      end

However, I never see any e-mail sent to my account... I have even tried hard coding the start times to be Time.now, and sending them out 0 minutes before, but no luck... Am I doing something glaringly wrong?

A: 

The iCalendar gem will not handle notification sending - alarm is just an concept in for ical. You have to implement your own service which dispatches email notifications and attach the generated ical data.

Marcel J.
Man, totally misunderstood, then....
Jenny