class TwistedCaldav::Format::Pretty

Public Instance Methods

parse_calendar(s) click to toggle source
# File lib/twisted-caldav/format.rb, line 13
def parse_calendar(s)
  result = ""
  xml = REXML::Document.new(s)

  REXML::XPath.each( xml, '//c:calendar-data/', {"c"=>"urn:ietf:params:xml:ns:caldav"} ){|c| result << c.text}
  r = Icalendar.parse(result)
  r
end
parse_events( vcal ) click to toggle source
# File lib/twisted-caldav/format.rb, line 44
def parse_events( vcal )
  Icalendar.parse(vcal)        
end
parse_single( body ) click to toggle source
# File lib/twisted-caldav/format.rb, line 48
def parse_single( body )
  # FIXME: parse event/todo/vcard
  parse_events( body )
end
parse_tasks( vcal ) click to toggle source
# File lib/twisted-caldav/format.rb, line 33
def parse_tasks( vcal )
  return_tasks = Array.new
  cals = Icalendar.parse(vcal)
  cals.each { |tcal|
    tcal.todos.each { |ttask|  # FIXME
      return_tasks << ttask
    }
  }
  return return_tasks
end
parse_todo( body ) click to toggle source
# File lib/twisted-caldav/format.rb, line 22
def parse_todo( body )
  result = []
  xml = REXML::Document.new( body )
  REXML::XPath.each( xml, '//c:calendar-data/', { "c"=>"urn:ietf:params:xml:ns:caldav"} ){ |c|
    p c.text
    p parse_tasks( c.text )
    result += parse_tasks( c.text )
  }
  return result
end