Parent

Methods

VcfBdayIcsServlet

Public Instance Methods

do_GET(req, resp) click to toggle source
# File lib/vpim/agent/scraps.rb, line 105
def do_GET(req, resp)
  cal = Vpim::Icalendar.create

  open($vcf_bday_file) do |vcf|
    Vpim::Vcard.decode(vcf).each do |card|
      begin
        bday = card.birthday
        if bday
          cal.push Vpim::Icalendar::Vevent.create_yearly(
            card.birthday,
            "Birthday for #{card['fn'].strip}"
            )
          $stderr.puts "#{card['fn']} -> bday #{cal.events.last.dtstart}"
        end
      rescue
        $stderr.puts $!
        $stderr.puts $!.backtrace.join("\n")
      end
    end
  end

  resp.body = cal.encode
  resp['content-type'] = 'text/calendar'

  # Is this necessary, or is it default?
  raise WEBrick::HTTPStatus::OK
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.