How to use ri_cal

210 views
Skip to first unread message

Abhi

unread,
Oct 4, 2010, 11:45:06 AM10/4/10
to RiCal
I am new bee in ruby as well as in ri_cal.

I want to use ri_cal for creating appointment and cancel appointment
at run time. Then attach in a mail and send.
The code which i am using is


def get_cal email_address, appt_date, start_time, end_time
return RiCal.Calendar do |cal|
cal.event do |event|
event.description = "MA-6 First US Manned
Spaceflight"
event.dtstart =
DateTime.parse(appt_date.strftime("%m/%d/%Y").to_str + " " +
start_time.strftime('%H:%M').to_str)#"2/20/1962 14:47:39")
event.dtend =
DateTime.parse(appt_date.strftime("%m/%d/%Y").to_str + " " +
end_time.strftime('%H:%M').to_str)
event.add_attendee email_address
event.alarm do
description "Segment 51"
end
end
end
end

and in mailer utility, i am using it like

appt_ics = get_cal appointment.calendar.staff.email_address,
appointment.appt_date, appointment.start_time , appointment.end_time
attachment :content_type => "text/plain",
:filename => "appointment.ics",
:body => appt_ics

It gives an error

can't convert RiCal::Component::Calendar into String

Please suggest.

Thanks

Rick DeNatale

unread,
Oct 4, 2010, 1:08:51 PM10/4/10
to rica...@googlegroups.com

What gives an error? Is there an exception backtrace? You need to
give us more help to help you.

> Please suggest.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups "RiCal" group.
> To post to this group, send email to rica...@googlegroups.com.
> To unsubscribe from this group, send email to rical_gem+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rical_gem?hl=en.
>
>

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Message has been deleted

Abhi

unread,
Oct 4, 2010, 2:48:11 PM10/4/10
to RiCal
Hi Rick,

Thanks for quick reply, but i am able to resolve the issue.

Once again thanks

On Oct 4, 10:08 pm, Rick DeNatale <rick.denat...@gmail.com> wrote:
> > For more options, visit this group athttp://groups.google.com/group/rical_gem?hl=en.
Reply all
Reply to author
Forward
0 new messages