Parent

Methods

IcalTodoRssServlet

Public Instance Methods

do_GET(req, resp) click to toggle source
# File lib/vpim/agent/scraps.rb, line 208
def do_GET(req, resp)   
  rss = RSS::Maker.make("0.9") do |maker|
    title = $ics_todo_title
    link = 'http:///'
    maker.channel.title = title
    maker.channel.link = link
    maker.channel.description = title
    maker.channel.language = 'en-us'

    # These are required, or RSS::Maker silently returns nil!
    maker.image.url = "maker.image.url"
    maker.image.title = "maker.image.title"

    Dir[ $ical_folder + "/*.ics" ].each do |file|
      # TODO: use the open with a block variant
      Vpim::Icalendar.decode(File.open(file)).each do |cal|
        cal.todos.each do |todo|
          if !todo.status || todo.status.upcase != "COMPLETED"
            item = maker.items.new_item
            item.title = todo.summary
            item.link =  todo.properties['url'] || link
            item.description = todo.description || todo.summary
          end
        end
      end
    end
  end

  resp.body = rss.to_s
  resp['content-type'] = 'text/xml'

  raise WEBrick::HTTPStatus::OK
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.