module Calligraphy::XML::WebDavElements
Methods to help build WebDAV elements and properties.
Constants
- DAV_NS_METHODS
- DAV_NS_TAGS
Public Instance Methods
lock_response(activelock_properties)
click to toggle source
Build an XML
response for a LOCK request.
# File lib/calligraphy/xml/web_dav_elements.rb, line 20 def lock_response(activelock_properties) build :prop do |xml| xml.lockdiscovery do activelock_properties.each do |properties| xml.activelock do iterate_and_drilldown xml, properties end end end end end
propfind_response(path, properties)
click to toggle source
Build an XML
response for a PROPFIND request.
# File lib/calligraphy/xml/web_dav_elements.rb, line 33 def propfind_response(path, properties) multistatus do |xml| href xml, path propstat xml, properties[:found], :ok propstat xml, properties[:not_found], :not_found end end
proppatch_response(path, actions)
click to toggle source
Build an XML
response for a PROPPATCH request.
# File lib/calligraphy/xml/web_dav_elements.rb, line 42 def proppatch_response(path, actions) multistatus do |xml| href xml, path propstat xml, actions[:set] propstat xml, actions[:remove] end end
Private Instance Methods
lockscope(xml, scope)
click to toggle source
# File lib/calligraphy/xml/web_dav_elements.rb, line 71 def lockscope(xml, scope) xml[@dav_ns].lockscope do self_closing_tag xml, scope end end
locktype(xml, type)
click to toggle source
# File lib/calligraphy/xml/web_dav_elements.rb, line 77 def locktype(xml, type) xml[@dav_ns].locktype do self_closing_tag xml, type end end
resourcetype(xml, property)
click to toggle source
# File lib/calligraphy/xml/web_dav_elements.rb, line 52 def resourcetype(xml, property) xml[@dav_ns].resourcetype do self_closing_tag xml, property.text if property.text == 'collection' end end
supportedlock(xml, property)
click to toggle source
# File lib/calligraphy/xml/web_dav_elements.rb, line 58 def supportedlock(xml, property) children = JSON.parse property.text, symbolize_names: true xml[@dav_ns].supportedlock do children.each do |child| xml[@dav_ns].lockentry do lockscope xml, child[:lockentry][:lockscope] locktype xml, child[:lockentry][:locktype] end end end end
timeout(xml, property)
click to toggle source
NOTE: `xml.send timeout` results in Timeout being called, so we have this timeout method for convenience.
# File lib/calligraphy/xml/web_dav_elements.rb, line 85 def timeout(xml, property) xml[@dav_ns].timeout do xml.text property.text end end