class Mhc::CalDav::ReportCollection

Public Class Methods

new() click to toggle source
# File lib/mhc/caldav.rb, line 66
def initialize
  @db = {}
  @calendar_property = nil
end
parse(xml) click to toggle source
# File lib/mhc/caldav.rb, line 95
def self.parse(xml)
  db = self.new
  xml = REXML::Document.new(xml) if xml.is_a?(String)

  xml.elements.each("D:multistatus/D:response") do |res|
    if res.elements["D:propstat/D:prop/D:resourcetype/D:collection"]
      db.set_calendar_property(res.elements["D:propstat/D:prop"])
    else
      db.update(Report.parse(res))
    end
  end
  return db
end

Public Instance Methods

calendar_property() click to toggle source
# File lib/mhc/caldav.rb, line 87
def calendar_property
  @calendar_property
end
collection() click to toggle source
# File lib/mhc/caldav.rb, line 71
def collection
  return @db
end
find(uid) click to toggle source
# File lib/mhc/caldav.rb, line 75
def find(uid)
  return @db[uid]
end
set_calendar_property(xml) click to toggle source
# File lib/mhc/caldav.rb, line 91
def set_calendar_property(xml)
  @calendar_property = CalendarProperty.parse(xml)
end
uid_list() click to toggle source
# File lib/mhc/caldav.rb, line 79
def uid_list
  return @db.keys
end
update(info) click to toggle source
# File lib/mhc/caldav.rb, line 83
def update(info)
  @db[info.uid] = info
end