From MR-Mencel at wiu.edu Tue Dec 11 17:22:28 2007 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Tue, 11 Dec 2007 16:22:28 -0600 (CST) Subject: [iCalendar-devel] How To Set Recurrence? In-Reply-To: <474FF0C6.6050500@rosejn.net> Message-ID: <1835450672.574071197411748333.JavaMail.root@zcs5.wiu.edu> I am trying to create an iCal event entry with recurrence...based on the samples I've got a block like this... cal.event do dtstart Date.new(startDate.year(), startDate.month(), startDate.day()) dtend Date.new(endDate.year(), endDate.month(), endDate.day()) summary "#{program} #{number}" description "Course Details: COURSE: #{name} - #{courseTitle} INSTRUCTOR: #{instructor}" klass "PUBLIC" location "#{location}" uid "#{user.uid}#{program}#{number}#{starnum}" recurrence_rules "RRULE:FREQ=WEEKLY;UNTIL=20071225;INTERVAL=1;BYDAY=TU,TH" end But it returns the following error... component.rb:208:in `recurrence_rules=': recurrence_rules is a multi-property that must be an array! Use the add_[property] method to add single entries. (ArgumentError) I tried a couple different ways of using add_component with recurrence_rules, but I haven't been able to figure it out yet. How do you add recurrence to an event? Another thing I'm curious about, I tried using "category" to add an event category, but it gave me the NoMethodError....so I guess that's not a valid event option? Thanks, Matt ----- Original Message ----- From: "Jeff Rose" To: "brian leroux" , "iCalendar developers & users" Sent: Friday, November 30, 2007 5:15:18 AM (GMT-0600) America/Chicago Subject: Re: [iCalendar-devel] getting a method missing for 'summary' -- help w/ remote ical! Hi Brian, I think the best way to debug things is if you can post an example calendar to the list which breaks the library. By looking at your stack trace it seems to be a bad calendar to me. I could be mistaken though. (It looks like it's trying to parse a FreeBusy component when it runs into a summary property. FreeBusy's don't have a summary, so that would be a bogus entry.) Either way, it would be good to figure out what's going on, and maybe the library should do a better job of continuing on past bad calendar properties and/or components. Not sure what I think about that though... -Jeff Brian LeRoux wrote: > Any help greatly appreciated! Showing rather than explaining below > (url changed): > > > irb(main):002:0> require 'rubygems' > => true > > irb(main):003:0> require 'net/http' > => true > > irb(main):004:0> url = URI.parse 'http://www.somewebsite/basic.ics' > => # > > irb(main):005:0> req = Net::HTTP::Get.new(url.path) > => # > > irb(main):006:0> res = Net::HTTP.start(url.host, url.port) {|http| > http.request(req) } > => # > > irb(main):007:0> require 'icalendar' > => true > > irb(main):008:0> Icalendar.parse res.body > > NoMethodError: Method Name: summary > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/component.rb:413:in > `method_missing' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:179:in > `send' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:179:in > `parse_component' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:139:in > `parse_component' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:101:in > `parse' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:16:in > `parse' > from (irb):8 > from /opt/local/lib/ruby/1.8/time.rb:53 > _______________________________________________ > 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 From MR-Mencel at wiu.edu Wed Dec 12 12:51:13 2007 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Wed, 12 Dec 2007 11:51:13 -0600 (CST) Subject: [iCalendar-devel] How To Set Recurrence? In-Reply-To: <1835450672.574071197411748333.JavaMail.root@zcs5.wiu.edu> Message-ID: <744609448.676021197481873961.JavaMail.root@zcs5.wiu.edu> This list is pretty quiet....just checking to see if anyone is awake... :) Matt ----- Original Message ----- From: "Matt Mencel" To: icalendar-devel at rubyforge.org Sent: Tuesday, December 11, 2007 4:22:28 PM (GMT-0600) America/Chicago Subject: [iCalendar-devel] How To Set Recurrence? I am trying to create an iCal event entry with recurrence...based on the samples I've got a block like this... cal.event do dtstart Date.new(startDate.year(), startDate.month(), startDate.day()) dtend Date.new(endDate.year(), endDate.month(), endDate.day()) summary "#{program} #{number}" description "Course Details: COURSE: #{name} - #{courseTitle} INSTRUCTOR: #{instructor}" klass "PUBLIC" location "#{location}" uid "#{user.uid}#{program}#{number}#{starnum}" recurrence_rules "RRULE:FREQ=WEEKLY;UNTIL=20071225;INTERVAL=1;BYDAY=TU,TH" end But it returns the following error... component.rb:208:in `recurrence_rules=': recurrence_rules is a multi-property that must be an array! Use the add_[property] method to add single entries. (ArgumentError) I tried a couple different ways of using add_component with recurrence_rules, but I haven't been able to figure it out yet. How do you add recurrence to an event? Another thing I'm curious about, I tried using "category" to add an event category, but it gave me the NoMethodError....so I guess that's not a valid event option? Thanks, Matt ----- Original Message ----- From: "Jeff Rose" To: "brian leroux" , "iCalendar developers & users" Sent: Friday, November 30, 2007 5:15:18 AM (GMT-0600) America/Chicago Subject: Re: [iCalendar-devel] getting a method missing for 'summary' -- help w/ remote ical! Hi Brian, I think the best way to debug things is if you can post an example calendar to the list which breaks the library. By looking at your stack trace it seems to be a bad calendar to me. I could be mistaken though. (It looks like it's trying to parse a FreeBusy component when it runs into a summary property. FreeBusy's don't have a summary, so that would be a bogus entry.) Either way, it would be good to figure out what's going on, and maybe the library should do a better job of continuing on past bad calendar properties and/or components. Not sure what I think about that though... -Jeff Brian LeRoux wrote: > Any help greatly appreciated! Showing rather than explaining below > (url changed): > > > irb(main):002:0> require 'rubygems' > => true > > irb(main):003:0> require 'net/http' > => true > > irb(main):004:0> url = URI.parse 'http://www.somewebsite/basic.ics' > => # > > irb(main):005:0> req = Net::HTTP::Get.new(url.path) > => # > > irb(main):006:0> res = Net::HTTP.start(url.host, url.port) {|http| > http.request(req) } > => # > > irb(main):007:0> require 'icalendar' > => true > > irb(main):008:0> Icalendar.parse res.body > > NoMethodError: Method Name: summary > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/component.rb:413:in > `method_missing' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:179:in > `send' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:179:in > `parse_component' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:139:in > `parse_component' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:101:in > `parse' > from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:16:in > `parse' > from (irb):8 > from /opt/local/lib/ruby/1.8/time.rb:53 > _______________________________________________ > 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 _______________________________________________ icalendar-devel mailing list icalendar-devel at rubyforge.org http://rubyforge.org/mailman/listinfo/icalendar-devel From MR-Mencel at wiu.edu Wed Dec 12 14:36:14 2007 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Wed, 12 Dec 2007 13:36:14 -0600 (CST) Subject: [iCalendar-devel] How To Set Recurrence? In-Reply-To: <4760266C.2040501@gmail.com> Message-ID: <184569105.700971197488174620.JavaMail.root@zcs5.wiu.edu> Jeff, Hmmm...no it never came through yesterday, I looked through my Junk folder too. We greylist here but I don't think that is the problem. Anyway....that cleared things up for me...thanks. I added the array brackets [] around the RRULE entry and it works now. Tested it with "add_recurrence_rule" and that worked too. Both of these worked for me... recurrence_rules ["FREQ=WEEKLY;UNTIL=#{endDate.strftime(fmt='%Y%m%d')};INTERVAL=1;BYDAY=#{days}"] or add_recurrence_rule "FREQ=WEEKLY;UNTIL=#{endDate.strftime(fmt='%Y%m%d')};INTERVAL=1;BYDAY=#{days}" It's adding some extra backslashes to the RRULE line in the resulting ICS file for some reason. Seems to be happening whenever it runs into a semicolon or comma in the original string. RRULE:FREQ=WEEKLY\;UNTIL=20080509\;INTERVAL=1\;BYDAY=TU\,TH Something I need to do with the punctuation....or will this be ok? Thanks, Matt ----- Original Message ----- From: "Jeff Rose" To: "iCalendar developers & users" , MR-Mencel at wiu.edu Sent: Wednesday, December 12, 2007 12:20:28 PM (GMT-0600) America/Chicago Subject: Re: [iCalendar-devel] How To Set Recurrence? Did you not get my response yesterday? In iCal events you can have two different types of properties, those that can only have a single occurrence, like dtstart, and those that can have multiple occurrences, like comment, category, recurrence_rule. For any of the multiple occurrence properties you can either assign them all at once using an array (categories = [a, b, c]), or you can add/remove single instances separately (add_category a). Check out the component_test.rb in the unit tests to see an example using the comment property. peace, Jeff Matt Mencel wrote: > This list is pretty quiet....just checking to see if anyone is awake... :) > > Matt > > ----- Original Message ----- > From: "Matt Mencel" > To: icalendar-devel at rubyforge.org > Sent: Tuesday, December 11, 2007 4:22:28 PM (GMT-0600) America/Chicago > Subject: [iCalendar-devel] How To Set Recurrence? > > I am trying to create an iCal event entry with recurrence...based on the samples I've got a block like this... > > cal.event do > dtstart Date.new(startDate.year(), startDate.month(), startDate.day()) > dtend Date.new(endDate.year(), endDate.month(), endDate.day()) > summary "#{program} #{number}" > description "Course Details: > COURSE: #{name} - #{courseTitle} > INSTRUCTOR: #{instructor}" > klass "PUBLIC" > location "#{location}" > uid "#{user.uid}#{program}#{number}#{starnum}" > recurrence_rules "RRULE:FREQ=WEEKLY;UNTIL=20071225;INTERVAL=1;BYDAY=TU,TH" > end > > But it returns the following error... > > component.rb:208:in `recurrence_rules=': recurrence_rules is a multi-property that must be an array! Use the add_[property] method to add single entries. (ArgumentError) > > > I tried a couple different ways of using add_component with recurrence_rules, but I haven't been able to figure it out yet. How do you add recurrence to an event? > > Another thing I'm curious about, I tried using "category" to add an event category, but it gave me the NoMethodError....so I guess that's not a valid event option? > > Thanks, > Matt > > > > > > ----- Original Message ----- > From: "Jeff Rose" > To: "brian leroux" , "iCalendar developers & users" > Sent: Friday, November 30, 2007 5:15:18 AM (GMT-0600) America/Chicago > Subject: Re: [iCalendar-devel] getting a method missing for 'summary' -- help w/ remote ical! > > Hi Brian, > I think the best way to debug things is if you can post an example > calendar to the list which breaks the library. By looking at your stack > trace it seems to be a bad calendar to me. I could be mistaken though. > (It looks like it's trying to parse a FreeBusy component when it runs > into a summary property. FreeBusy's don't have a summary, so that would > be a bogus entry.) Either way, it would be good to figure out what's > going on, and maybe the library should do a better job of continuing on > past bad calendar properties and/or components. Not sure what I think > about that though... > > -Jeff > > Brian LeRoux wrote: >> Any help greatly appreciated! Showing rather than explaining below >> (url changed): >> >> >> irb(main):002:0> require 'rubygems' >> => true >> >> irb(main):003:0> require 'net/http' >> => true >> >> irb(main):004:0> url = URI.parse 'http://www.somewebsite/basic.ics' >> => # >> >> irb(main):005:0> req = Net::HTTP::Get.new(url.path) >> => # >> >> irb(main):006:0> res = Net::HTTP.start(url.host, url.port) {|http| >> http.request(req) } >> => # >> >> irb(main):007:0> require 'icalendar' >> => true >> >> irb(main):008:0> Icalendar.parse res.body >> >> NoMethodError: Method Name: summary >> from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/component.rb:413:in >> `method_missing' >> from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:179:in >> `send' >> from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:179:in >> `parse_component' >> from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:139:in >> `parse_component' >> from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:101:in >> `parse' >> from /opt/local/lib/ruby/gems/1.8/gems/icalendar-1.0.1/lib/icalendar/parser.rb:16:in >> `parse' >> from (irb):8 >> from /opt/local/lib/ruby/1.8/time.rb:53 >> _______________________________________________ >> 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 > > _______________________________________________ > 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 From andres at paglayan.com Thu Dec 13 13:18:07 2007 From: andres at paglayan.com (Andres Paglayan) Date: Thu, 13 Dec 2007 11:18:07 -0700 Subject: [iCalendar-devel] icalendar rails model Message-ID: <9280DEFA-B059-4616-ADC0-4F645C0A86CA@paglayan.com> Hi, First of all, thank you for this amazing library and for the value it adds to the community, I am working in this project: http://linuxemr.org And will do all scheduling parsing using iCal standard, for which this library is "the" way to go. (I am pretty much trying to imitate google's cal) Please correct me where I am wrong with my thinking, and let me know how you'd do it. I am thinking of creating a rails model that matches icalendar definitions, and thinking of storing all its data into the database, not sure yet about the following: Does it makes sense to map it into a database? For display, I am thinking on a xml builder template that can receive variables such as time interval, time start, time end, day start (for week), day end (for week) and I still need a way to figure out how to assign a unique id (for the ajax staff and to populate the
) for each time slot, so far my thinking is that i can include a calculated timestamp as the id into xml template builder Any hint that will help me in the right direction is highly appreciated. Thank you in advance, Andres