Gaius Centus Novus
2008-Apr-19 15:36 UTC
[iCalendar-devel] getting a method missing for ''summary'' -- help w/ remote ical!
I''m having the same problem - GMail''s FreeBusy feeds contain a
summary
element. The simplest fix I''ve found is to run any feed you know
should be a FreeBusy through a gsub! before passing it off to the
parser:
Icalendar::Parser.new(google_freebusy_feed.gsub("SUMMARY:Busy\r\n",
'')).parse
A more elegant solution might be to have a strict setting on the
parser that we could turn off to ignore errors:
Icalendar::Parser.new(google_freebusy_feed, :strict => false).parse
What''s interesting is that
Icalendar::Freebusy.new.respond_to?(''summary'')
returns true. If it didn''t, I don''t think the parser would
even
bother to try to set the field. Lines 178-182 of parser.rb read
if component.respond_to?(name)
component.send(name, value, params)
else
raise(UnknownPropertyMethod, "Unknown property type: #{name}")
end
The error we _should_ be getting is an UnknownPropertyMethod, not a
NoMethodError.
-Gaius
<<<
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''
> => #<URI::HTTP:0x271618
URL:http:/mygooglecalendar.com/public/basic.ics>
>
> irb(main):005:0> req = Net::HTTP::Get.new(url.path)
> => #<Net::HTTP::Get GET>
>
> irb(main):006:0> res = Net::HTTP.start(url.host, url.port) {|http|
> http.request(req) }
> => #<Net::HTTPOK 200 OK readbody=true>
>
> 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
>>>