Sha256: a2c2b24a4a39c3d41b819c82d6ea1f9072ecca01b7d27a85478c641a05d36c2b

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'vpim/icalendar'

cal = Vpim::Icalendar.create2

cal.add_event do |e|
  e.dtstart       Date.new(2005, 04, 28)
  e.dtend         Date.new(2005, 04, 29)
  e.summary       "Monthly meet-the-CEO day"
  e.description <<'---'
Unlike last one, this meeting will change your life because
we are going to discuss your likely demotion if your work isn't
done soon.
---
  e.categories    [ 'APPOINTMENT' ]
  e.categories do |c| c.push 'EDUCATION' end
  e.url           'http://www.example.com'
  e.sequence      0
  e.access_class  "PRIVATE"
  e.transparency  'OPAQUE'
  e.set_text('LOCATION', 'my location')

  now = Time.now
  e.created       now
  e.lastmod       now


  e.organizer do |o|
    o.cn = "Example Organizer, Mr."
    o.uri = "mailto:organizer@example.com"
  end

  attendee = Vpim::Icalendar::Address.create("mailto:attendee@example.com")
  attendee.rsvp = true
  e.add_attendee attendee
end

icsfile = cal.encode

puts '--- Encode:'

puts icsfile

puts '--- Decode:'

cal = Vpim::Icalendar.decode(icsfile).first

cal.components do |e|
  puts e.summary
  puts e.description
  puts e.dtstart.to_s
  puts e.dtend.to_s
end


Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
thoughtafter-vpim-0.7.0.1 ex_ics_api.rb
scashin133-vpim-9.4.0 ex_ics_api.rb