Tom Gagne
2013-Mar-15 04:25 UTC
[iCalendar-devel] Icalendar.Parse(StringIO.new(aString)) complains about missing method, bytesize
I need to send an ics file to a web service, so however it gets there it will arrive as a string. Is there another way to begin Icalendar''s Parse than with a file? I''m currently sending the file using the curl command... curl -v --data-urlencode ics at invite.ics http://127.0.0.1:4567/ics2event I''ve tried curl''s --data-binary and sinatra''s request.body.string to create the stringio object, without luck. Ultimately it complains NoMethodError at /ics2event undefined method `bytesize'' for #<Icalendar::Calendar:0x9c8b1b8> file: component.rb location: method_missing line: 419 My web code is below. require ''sinatra'' require ''rubygems'' require ''icalendar'' get ''/'' do "Hello, world!" end get ''/test'' do "You''ve found me!" end post ''/ics2event'' do #puts request.body.string invite = StringIO.new(params["ics"]) cals = Icalendar.parse(invite) for each in cals do for eachEvent in each.events do puts eachEvent.summary puts eachEvent.description puts eachEvent.location puts eachEvent.status puts eachEvent.dtstart puts eachEvent.dtend puts eachEvent.organizer for eachAttendee in eachEvent.attendees do puts eachAttendee.to end end end end
Sean Dague
2013-Mar-15 10:41 UTC
[iCalendar-devel] Icalendar.Parse(StringIO.new(aString)) complains about missing method, bytesize
Can you share what the ical file that you are parsing looks like as well? On Fri, Mar 15, 2013 at 12:25 AM, Tom Gagne <tgagne at xede.com> wrote:> I need to send an ics file to a web service, so however it gets there it > will arrive as a string. Is there another way to begin Icalendar''s Parse > than with a file? > > I''m currently sending the file using the curl command... > > curl -v --data-urlencode ics at invite.ics http://127.0.0.1:4567/**ics2event<http://127.0.0.1:4567/ics2event> > > I''ve tried curl''s --data-binary and sinatra''s request.body.string to > create the stringio object, without luck. > > Ultimately it complains > NoMethodError at /ics2event > undefined method `bytesize'' for #<Icalendar::Calendar:**0x9c8b1b8> > file: component.rb location: method_missing line: 419 > > My web code is below. > > require ''sinatra'' > require ''rubygems'' > require ''icalendar'' > > get ''/'' do > "Hello, world!" > end > > get ''/test'' do > "You''ve found me!" > end > > post ''/ics2event'' do > #puts request.body.string > > invite = StringIO.new(params["ics"]) > > cals = Icalendar.parse(invite) > > for each in cals do > for eachEvent in each.events do > puts eachEvent.summary > puts eachEvent.description > puts eachEvent.location > puts eachEvent.status > puts eachEvent.dtstart > puts eachEvent.dtend > puts eachEvent.organizer > for eachAttendee in eachEvent.attendees do > puts eachAttendee.to > end > end > end > end > > ______________________________**_________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/**listinfo/icalendar-devel<http://rubyforge.org/mailman/listinfo/icalendar-devel> >-- Sean Dague http://dague.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/icalendar-devel/attachments/20130315/6b43dc7a/attachment.html>
Tom Gagne
2013-Mar-15 14:38 UTC
[iCalendar-devel] Icalendar.Parse(StringIO.new(aString)) complains about missing method, bytesize
BEGIN:VCALENDAR PRODID:-//Google Inc//Google Calendar 70.9054//EN VERSION:2.0 CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT DTSTART:20130314T183000Z DTEND:20130314T192000Z DTSTAMP:20130314T161654Z ORGANIZER;CN=tgagne at ignoreme.com:mailto:tgagne at ignoreme.com UID:oj3cqef2gp3ssa7kqh3jn9f2qs at google.com ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP TRUE;CN=feedback at 5kb55ppv9nopeqboxfkchks1fccv2ntpn7w4atfgx6hijif9d.6-jqh3ea g.6.apex.salesforce.com;X-NUM-GUESTS=0:mailto:feedback at 5kb55ppv9nopeqboxfkc hks1fccv2ntpn7w4atfgx6hijif9d.6-jqh3eag.6.apex.salesforce.com ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP TRUE;CN=John Reedy;X-NUM-GUESTS=0:mailto:jreedy at ignoreme.com ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE ;CN=Thomas Gagne;X-NUM-GUESTS=0:mailto:tgagne at ignoreme.com ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP TRUE;CN=Eric Robertson;X-NUM-GUESTS=0:mailto:erobertson at ignoreme.com ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP TRUE;CN=Rick Ross;X-NUM-GUESTS=0:mailto:rross at ignoreme.com CREATED:20130314T161654Z DESCRIPTION:Run our questions and red flags past John Reedy.\n\n\nhttps://n a4.salesforce.com/0066000000MQTen\nView your event at http://www.google.com /calendar/event?action=VIEW&eid=b2ozY3FlZjJncDNzc2E3a3FoM2puOWYycXMgZmVlZGJ hY2tANWtiNTVwcHY5bm9wZXFib3hma2Noa3MxZmNjdjJudHBuN3c0YXRmZ3g2aGlqaWY5ZC42LW pxaDNlYWcuNi5hcGV4LnNhbGVzZm9yY2UuY29t&tok=MTUjdGdhZ25lQHhlZGUuY29tMjNjYzg5 Y2E5MmE1MzJkNDBhZGI4ZDVkYjIxZDA0NTAxZTdiZDUzYg&ctz=America/New_York&hl=en. LAST-MODIFIED:20130314T161654Z LOCATION:Rick''s office SEQUENCE:0 STATUS:CONFIRMED SUMMARY:FB-00463 - Review Estimate and Questions TRANSP:OPAQUE END:VEVENT END:VCALENDAR On 3/15/2013 6:41 AM, Sean Dague wrote:> Can you share what the ical file that you are parsing looks like as well?
Reasonably Related Threads
- table associations
- Re: vpim: bug in icalendar.rb, Icalendar#decode_status
- [patch] fix bytesize in exception template; multibyte titleize
- NoMethodError: `bytesize' for 200:Fixnum (with Rails-3.0.3)
- Icalendar::UnknownPropertyMethod: Unknown property type: on Parsing a ical file