class Vpim::Icalendar::Vevent
Public Class Methods
Create a new Vevent object. All events must have
a DTSTART field, specify it as either a Time
or a Date in start
, it defaults
to “now”
If specified, fields
must be either an array of Field objects
to add, or a Hash of String names to values that will be used to build
Field objects. The latter is a convenient short-cut allowing the Field
objects to be created for you when called like:
Vevent.create(Date.today, 'SUMMARY' => "today's event")
# File lib/vpim/vevent.rb, line 64 def Vevent.create(start = Time.now, fields=[]) # TODO # - maybe events are usually created in a particular way? With a # start/duration or a start/end? Maybe I can make it easier. Ideally, I # would like to make it hard to encode an invalid Event. # - I don't think its useful to have a default dtstart for events # - also, I don't think dstart is mandatory dtstart = DirectoryInfo::Field.create('DTSTART', start) di = DirectoryInfo.create([ dtstart ], 'VEVENT') Vpim::DirectoryInfo::Field.create_array(fields).each { |f| di.push_unique f } new(di.to_a) end
Creates a yearly repeating event, such as for a birthday.
# File lib/vpim/vevent.rb, line 80 def Vevent.create_yearly(date, summary) create( date, 'SUMMARY' => summary.to_str, 'RRULE' => 'FREQ=YEARLY' ) end
Public Instance Methods
Accept an event invitation. The invitee
is the Address that wishes to accept the event invitation
as confirmed.
The event created is identical to this one, but
-
without the attendees
-
with the invitee added with a PARTSTAT of ACCEPTED
# File lib/vpim/vevent.rb, line 94 def accept(invitee) # FIXME - move to Vpim::Itip. invitee = invitee.copy invitee.partstat = 'ACCEPTED' fields = [] @properties.each_with_index do |f,i| # put invitee in as field[1] fields << invitee.encode('ATTENDEE') if i == 1 fields << f unless f.name? 'ATTENDEE' end Vevent.new(fields) end
The end time for this Event. If the DTEND field is not present, but the DURATION field is, the end will be calculated from DTSTART and DURATION.
# File lib/vpim/vevent.rb, line 130 def dtend propend 'DTEND' end
The duration in seconds of an Event, or nil if unspecified. If the DURATION field is not present, but the DTEND field is, the duration is calculated from DTSTART and DTEND. Durations of zero seconds are possible.
# File lib/vpim/vevent.rb, line 123 def duration propduration 'DTEND' end
In iTIP, whether this event is OPAQUE or TRANSPARENT to scheduling. If transparency is not explicitly set, it defaults to OPAQUE.
# File lib/vpim/vevent.rb, line 115 def transparency proptoken 'TRANSP', ["OPAQUE", "TRANSPARENT"], "OPAQUE" end