Class: Tilia::Dav::Xml::Request::PropFind

Inherits:
Object
  • Object
show all
Includes:
Xml::XmlDeserializable
Defined in:
lib/tilia/dav/xml/request/prop_find.rb

Overview

WebDAV PROPFIND request parser.

This class parses the DAV:propfind request, as defined in:

tools.ietf.org/html/rfc4918#section-14.20

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePropFind

TODO: document



63
64
65
# File 'lib/tilia/dav/xml/request/prop_find.rb', line 63

def initialize
  @all_prop = false
end

Instance Attribute Details

#all_propObject

If this is set to true, this was an ‘allprop’ request.



16
17
18
# File 'lib/tilia/dav/xml/request/prop_find.rb', line 16

def all_prop
  @all_prop
end

#propertiesObject

The property list



21
22
23
# File 'lib/tilia/dav/xml/request/prop_find.rb', line 21

def properties
  @properties
end

Class Method Details

.xml_deserialize(reader) ⇒ Object

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.

Parameters:

  • Reader

    reader

Returns:

  • mixed



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/tilia/dav/xml/request/prop_find.rb', line 42

def self.xml_deserialize(reader)
  instance = new

  reader.push_context
  reader.element_map['{DAV:}prop'] = Tilia::Xml::Element::Elements

  Tilia::Xml::Element::KeyValue.xml_deserialize(reader).each do |k, v|
    case k
    when '{DAV:}prop'
      instance.properties = v
    when '{DAV:}allprop'
      instance.all_prop = true
    end
  end

  reader.pop_context

  instance
end