Alex Ghiculescu
Alex Ghiculescu

Reputation: 7540

How do I create an .ics event with a title using ri_cal

I'm using the ri_cal gem to create ics files. The gem's documentation suggests I do this:

RiCal.Calendar do |cal|
  cal.event do |event|
    event.description = "MA-6 First US Manned Spaceflight"
    event.dtstart =  DateTime.parse("2/20/1962 14:47:39")
    event.dtend = DateTime.parse("2/20/1962 19:43:02")
    event.location = "Cape Canaveral"
    event.add_attendee "[email protected]"
    event.alarm do
      description "Segment 51"
    end
  end
end

But when I open the .ics file this creates in OS X Calendar, the event has no title. Only the Description has been set as described.

How do I set the event's title?

Upvotes: 0

Views: 1948

Answers (1)

Alex Ghiculescu
Alex Ghiculescu

Reputation: 7540

Use event.summary:

RiCal.Calendar do |cal|
  cal.event do |event|
    event.summary = "The 'title' of the event"
    event.description = "MA-6 First US Manned Spaceflight"
    event.dtstart =  DateTime.parse("2/20/1962 14:47:39")
    event.dtend = DateTime.parse("2/20/1962 19:43:02")
    event.location = "Cape Canaveral"
    event.add_attendee "[email protected]"
    event.alarm do
      description "Segment 51"
    end
  end
end

ri_cal/properties/event.rb has a full list of properties you can set.

Upvotes: 3

Related Questions