From craig at tobyhouse.com Mon Feb 11 16:10:02 2008 From: craig at tobyhouse.com (Craig White) Date: Mon, 11 Feb 2008 14:10:02 -0700 Subject: [iCalendar-devel] getting at some of the attributes in my array... Message-ID: <1202764203.2965.13.camel@cube.tobyhouse.com> I unpacked the gem so I could make some alterations to the attributes... array that looks something like this... @events[0].properties.inspect "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 \"], \"organizer\"=>#, \"dtend\"=>#, \"uid \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire Extinguisher Inspection Due\", \"dtstart\"=>#, \"attendee\"=>[#, #], \"transp\"=>\"OPAQUE\", \"dtstamp\"=>#, \"location \"=>\"Bethany\"}" no problem here... @events[0].location => "Bethany" or here... @events[0].uid => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" but this is a problem... @events[0].rrule NoMethodError: Method Name: rrule from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing' from (irb):116 from :0 How can I fix this? Craig From craig at tobyhouse.com Wed Feb 27 17:34:20 2008 From: craig at tobyhouse.com (Craig White) Date: Wed, 27 Feb 2008 15:34:20 -0700 Subject: [iCalendar-devel] getting at some of the attributes in my array... In-Reply-To: <1202764203.2965.13.camel@cube.tobyhouse.com> References: <1202764203.2965.13.camel@cube.tobyhouse.com> Message-ID: <1204151660.24903.65.camel@cube.tobyhouse.com> On Mon, 2008-02-11 at 14:10 -0700, Craig White wrote: > I unpacked the gem so I could make some alterations to the attributes... > > array that looks something like this... > > @events[0].properties.inspect > "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 > \"], \"organizer\"=># URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=># 4908935/2,0,2299161>, \"uid > \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description > \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire > Extinguisher Inspection Due\", \"dtstart\"=># 4908933/2,0,2299161>, \"attendee\"=>[# URL:MAILTO:someone at tobyhouse.com>, # URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", > \"dtstamp\"=>#, \"location > \"=>\"Bethany\"}" > > no problem here... > @events[0].location > => "Bethany" > > or here... > @events[0].uid > => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" > > but this is a problem... > @events[0].rrule > NoMethodError: Method Name: rrule > > from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing' > from (irb):116 > from :0 > > How can I fix this? ---- well, I solved it but I'm not sure why but using @events[0].recurrence_rules was valid so in light of no responses from anyone and in case someone follows in my footsteps, this might be useful. Craig From MR-Mencel at wiu.edu Wed Feb 27 16:03:24 2008 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Wed, 27 Feb 2008 15:03:24 -0600 (CST) Subject: [iCalendar-devel] All Day Events Message-ID: <350623401.550201204146204633.JavaMail.root@zcs7.wiu.edu> I must be stupid because this cannot be this hard. I'm trying to build an all day calendar event. In most clients it shows up as an entry at the top of the day rather than blocking out the whole day with an event. I have a bit of code that looks like this... cal.event do dtstart DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}") dtend DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()+1}") end The ICAL entry from this looks like... DTSTART: 20080114T000000 DTEND: 20080115T000000 I also tried it in the format from the README cal.event do dtstart Date.nnew(2008, 01, 14) dtend Date.new(2008, 01, 15) end ...which produced... DTSTART: 20080114 DTEND: 20080115 When I create an all day event in my calendar system and export it to an ICS file it looks like this... DTSTART;VALUE=DATE:20080114 DTEND;VALUE=DATE:20080115 I'm sure one of my above options should work, but maybe there's something special I need to do to make an "all day" event? Thanks, Matt From jeff at rosejn.net Thu Feb 28 05:03:44 2008 From: jeff at rosejn.net (Jeff Rose) Date: Thu, 28 Feb 2008 11:03:44 +0100 Subject: [iCalendar-devel] All Day Events In-Reply-To: <350623401.550201204146204633.JavaMail.root@zcs7.wiu.edu> References: <350623401.550201204146204633.JavaMail.root@zcs7.wiu.edu> Message-ID: <47C68700.6030604@rosejn.net> Hi Matt, This is an area of the specification which isn't totally clear, and I've seen that people run into problems. What program are you using to view your calendars? If I create a basic event c = Icalendar::Calendar.new c.event do dtstart Date.new(2008, 1, 1) dtend Date.new(2008, 1, 2) end File.open("test.ics", "w") {|f| f.write(c.to_ical) } When imported into my Thunderbird calendar it comes up as being an all day event. Looking around on mailing lists it seems that some apps might want all-day events to span midnight to midnight, so you could give that a try with the app you are using. Let me know if it works, and we can try to find a cross-calendar-app fix. -Jeff Matt Mencel wrote: > I must be stupid because this cannot be this hard. > > I'm trying to build an all day calendar event. In most clients it shows up as an entry at the top of the day rather than blocking out the whole day with an event. > > I have a bit of code that looks like this... > > cal.event do > dtstart DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}") > dtend DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()+1}") > end > > The ICAL entry from this looks like... > > DTSTART: 20080114T000000 > DTEND: 20080115T000000 > > > I also tried it in the format from the README > > cal.event do > dtstart Date.nnew(2008, 01, 14) > dtend Date.new(2008, 01, 15) > end > > ...which produced... > DTSTART: 20080114 > DTEND: 20080115 > > > When I create an all day event in my calendar system and export it to an ICS file it looks like this... > > DTSTART;VALUE=DATE:20080114 > DTEND;VALUE=DATE:20080115 > > > > I'm sure one of my above options should work, but maybe there's something special I need to do to make an "all day" event? > > Thanks, > Matt > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel From jeff at rosejn.net Thu Feb 28 05:13:15 2008 From: jeff at rosejn.net (Jeff Rose) Date: Thu, 28 Feb 2008 11:13:15 +0100 Subject: [iCalendar-devel] getting at some of the attributes in my array... In-Reply-To: <1204151660.24903.65.camel@cube.tobyhouse.com> References: <1202764203.2965.13.camel@cube.tobyhouse.com> <1204151660.24903.65.camel@cube.tobyhouse.com> Message-ID: <47C6893B.4000303@rosejn.net> Hi Craig, This same type of question has come up a number of times in the mailing list, which probably means I should improve the examples and docs. Recurrence rules are one of a number of properties that can have multiple instances within an event. For these multiple instance properties there are plural methods that return arrays, and then there are singular methods to add and remove instances. If you take a look at lib/icalendar/components/event.rb you will see the definition list of all the valid properties, along with their plurality. If I were creating this API to build calendars without having to follow a specification it would work differently for a number of things, but since the goal is compatibility we are stuck with some oddity. That said, if you have ideas on how to make things cleaner I'm all ears (and very willing to accept patches :-). -Jeff Craig White wrote: > On Mon, 2008-02-11 at 14:10 -0700, Craig White wrote: >> I unpacked the gem so I could make some alterations to the attributes... >> >> array that looks something like this... >> >> @events[0].properties.inspect >> "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 >> \"], \"organizer\"=>#> URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=>#> 4908935/2,0,2299161>, \"uid >> \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description >> \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire >> Extinguisher Inspection Due\", \"dtstart\"=>#> 4908933/2,0,2299161>, \"attendee\"=>[#> URL:MAILTO:someone at tobyhouse.com>, #> URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", >> \"dtstamp\"=>#, \"location >> \"=>\"Bethany\"}" >> >> no problem here... >> @events[0].location >> => "Bethany" >> >> or here... >> @events[0].uid >> => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" >> >> but this is a problem... >> @events[0].rrule >> NoMethodError: Method Name: rrule >> >> from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing' >> from (irb):116 >> from :0 >> >> How can I fix this? > ---- > well, I solved it but I'm not sure why but using > @events[0].recurrence_rules was valid > > so in light of no responses from anyone and in case someone follows in > my footsteps, this might be useful. > > Craig > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel From craig at tobyhouse.com Thu Feb 28 10:58:13 2008 From: craig at tobyhouse.com (Craig White) Date: Thu, 28 Feb 2008 08:58:13 -0700 Subject: [iCalendar-devel] getting at some of the attributes in my array... In-Reply-To: <47C6893B.4000303@rosejn.net> References: <1202764203.2965.13.camel@cube.tobyhouse.com> <1204151660.24903.65.camel@cube.tobyhouse.com> <47C6893B.4000303@rosejn.net> Message-ID: <1204214294.24903.79.camel@cube.tobyhouse.com> Jeff, I don't really have ideas but thanks for all your efforts. I understand the point you are making and am not intending to be critical beyond my lack of understanding how to deal. In this case, it seemed clear that the attributes coming from my ical file used rrule but iCalendar uses some kind of secret decoder ring to correlate recurrence_rules to rrule. I suspect that much of my frustration was that I have been trying to go the opposite way...trying to parse ical files INTO ruby as opposed to creating ical files FROM ruby. As I said, I think I am more hamstrung by my lack of ruby skills and my severe lack of understanding the concept of calendars and ical files. Thanks Craig On Thu, 2008-02-28 at 11:13 +0100, Jeff Rose wrote: > Hi Craig, > This same type of question has come up a number of times in the > mailing list, which probably means I should improve the examples and > docs. Recurrence rules are one of a number of properties that can have > multiple instances within an event. For these multiple instance > properties there are plural methods that return arrays, and then there > are singular methods to add and remove instances. If you take a look at > lib/icalendar/components/event.rb you will see the definition list of > all the valid properties, along with their plurality. > > If I were creating this API to build calendars without having to follow > a specification it would work differently for a number of things, but > since the goal is compatibility we are stuck with some oddity. That > said, if you have ideas on how to make things cleaner I'm all ears (and > very willing to accept patches :-). > > -Jeff > > Craig White wrote: > > On Mon, 2008-02-11 at 14:10 -0700, Craig White wrote: > >> I unpacked the gem so I could make some alterations to the attributes... > >> > >> array that looks something like this... > >> > >> @events[0].properties.inspect > >> "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 > >> \"], \"organizer\"=># >> URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=># >> 4908935/2,0,2299161>, \"uid > >> \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description > >> \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire > >> Extinguisher Inspection Due\", \"dtstart\"=># >> 4908933/2,0,2299161>, \"attendee\"=>[# >> URL:MAILTO:someone at tobyhouse.com>, # >> URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", > >> \"dtstamp\"=>#, \"location > >> \"=>\"Bethany\"}" > >> > >> no problem here... > >> @events[0].location > >> => "Bethany" > >> > >> or here... > >> @events[0].uid > >> => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" > >> > >> but this is a problem... > >> @events[0].rrule > >> NoMethodError: Method Name: rrule > >> > >> from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing' > >> from (irb):116 > >> from :0 > >> > >> How can I fix this? > > ---- > > well, I solved it but I'm not sure why but using > > @events[0].recurrence_rules was valid > > > > so in light of no responses from anyone and in case someone follows in > > my footsteps, this might be useful. > > > > Craig From MR-Mencel at wiu.edu Thu Feb 28 12:44:34 2008 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Thu, 28 Feb 2008 11:44:34 -0600 (CST) Subject: [iCalendar-devel] All Day Events In-Reply-To: <47C68700.6030604@rosejn.net> Message-ID: <2128217406.666581204220674568.JavaMail.root@zcs7.wiu.edu> Jeff, Thanks for the response. I found my problem and it wasn't a bug in your code, but a bug in mine. I had changed my variable names to make the code more readable and never went and changed it in the function call that adds the events to my calendar system. ERG! So I did get it working and it actually works pretty slick. The "arranged" events are the all day events...so I just had to use the 'Date.new' and give it the (year, month, day) and it works. I could do it with dtstart and dtend being the same day...or with dtend being the same day +1. cal.event do if arranged dtstart Date.new(startDate.year(), startDate.month(), startDate.day()) dtend Date.new(startDate.year(), startDate.month(), startDate.day()) else dtstart DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}T#{startTime}:00") dtend DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}T#{endTime}:00") end The resulting ICAL looks like... DTSTART: 20080114T000000 DTEND: 20080114T000000 I'm working with the Zimbra Collaboration Suite and writing ruby code to import our students class schedules into their calendars automatically...and it seems to work fine when I use the correct variable names. :P Thanks, Matt ----- Original Message ----- From: "Jeff Rose" To: "iCalendar developers & users" Sent: Thursday, February 28, 2008 4:03:44 AM (GMT-0600) America/Guatemala Subject: Re: [iCalendar-devel] All Day Events Hi Matt, This is an area of the specification which isn't totally clear, and I've seen that people run into problems. What program are you using to view your calendars? If I create a basic event c = Icalendar::Calendar.new c.event do dtstart Date.new(2008, 1, 1) dtend Date.new(2008, 1, 2) end File.open("test.ics", "w") {|f| f.write(c.to_ical) } When imported into my Thunderbird calendar it comes up as being an all day event. Looking around on mailing lists it seems that some apps might want all-day events to span midnight to midnight, so you could give that a try with the app you are using. Let me know if it works, and we can try to find a cross-calendar-app fix. -Jeff Matt Mencel wrote: > I must be stupid because this cannot be this hard. > > I'm trying to build an all day calendar event. In most clients it shows up as an entry at the top of the day rather than blocking out the whole day with an event. > > I have a bit of code that looks like this... > > cal.event do > dtstart DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()}") > dtend DateTime.parse("#{startDate.year()}-#{startDate.month()}-#{startDate.day()+1}") > end > > The ICAL entry from this looks like... > > DTSTART: 20080114T000000 > DTEND: 20080115T000000 > > > I also tried it in the format from the README > > cal.event do > dtstart Date.nnew(2008, 01, 14) > dtend Date.new(2008, 01, 15) > end > > ...which produced... > DTSTART: 20080114 > DTEND: 20080115 > > > When I create an all day event in my calendar system and export it to an ICS file it looks like this... > > DTSTART;VALUE=DATE:20080114 > DTEND;VALUE=DATE:20080115 > > > > I'm sure one of my above options should work, but maybe there's something special I need to do to make an "all day" event? > > Thanks, > Matt > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel _______________________________________________ icalendar-devel mailing list icalendar-devel at rubyforge.org http://rubyforge.org/mailman/listinfo/icalendar-devel