class Mhc::CalDav::Report

Attributes

content_type[RW]
etag[RW]
href[RW]
ics[RW]
status[RW]
uid[RW]

Public Class Methods

parse(xmldoc) click to toggle source
# File lib/mhc/caldav.rb, line 18
def self.parse(xmldoc)
  info = self.new

  href, status, content_type, etag, ics =
    %w(D:href
       D:propstat/D:status
       D:propstat/D:prop/D:getcontenttype
       D:propstat/D:prop/D:getetag
       D:propstat/D:prop/caldav:calendar-data
    ).map{|e| xmldoc.elements[e].text rescue nil}

  info.href = URI.decode_www_form_component(href)
  info.uid = File.basename(info.href, ".ics")
  info.status = status
  info.content_type = content_type
  info.etag = etag # unquote_string(etag)
  info.ics = ics
  return info
end

Private Class Methods

unquote_string(str) click to toggle source
# File lib/mhc/caldav.rb, line 40
def self.unquote_string(str)
  return str.gsub('"', "")
end