class Tilia::Dav::Xml::Request::MkCol

WebDAV Extended MKCOL request parser.

This class parses the {DAV:}mkol request, as defined in:

tools.ietf.org/html/rfc5689#section-5.1

Attributes

properties[RW]

The list of properties that will be set.

@var array

Public Class Methods

new() click to toggle source
# File lib/tilia/dav/xml/request/mk_col.rb, line 62
def initialize
  @properties = {}
end
xml_deserialize(reader) click to toggle source

The deserialize method is called during xml parsing.

This method is called statictly, this is because in theory this method may be used as a type of constructor, or factory method.

Often you want to return an instance of the current class, but you are free to return other data as well.

You are responsible for advancing the reader to the next element. Not doing anything will result in a never-ending loop.

If you just want to skip parsing for this element altogether, you can just call reader.next

reader.parse_inner_tree will parse the entire sub-tree, and advance to the next element.

@param Reader reader @return mixed

# File lib/tilia/dav/xml/request/mk_col.rb, line 43
def self.xml_deserialize(reader)
  instance = new

  element_map = reader.element_map
  element_map['{DAV:}prop']   = Element::Prop
  element_map['{DAV:}set']    = Tilia::Xml::Element::KeyValue
  element_map['{DAV:}remove'] = Tilia::Xml::Element::KeyValue

  elems = reader.parse_inner_tree(element_map)

  elems.each do |elem|
    if elem['name'] == '{DAV:}set'
      instance.properties.merge!(elem['value']['{DAV:}prop'])
    end
  end

  instance
end