Module: Calligraphy::XML::WebDavElements

Included in:
Builder
Defined in:
lib/calligraphy/xml/web_dav_elements.rb

Overview

Methods to help build WebDAV elements and properties.

Constant Summary collapse

DAV_NS_TAGS =
%w[
  activelock allprop collection creationdate depth displayname error
  exclusive getcontentlanguage getcontentlength getcontenttype getetag
  getlastmodified href include location lockdiscovery lockentry lockinfo
  lockroot lockscope locktoken locktype multistatus owner prop
  propertyupdate propfind propname propstat remove response
  responsedescription resourcetype set shared status supportedlock
  timeout write
].freeze
DAV_NS_METHODS =
%w[resourcetype supportedlock timeout].freeze

Instance Method Summary collapse

Instance Method Details

#lock_response(activelock_properties) ⇒ Object

Build an XML response for a LOCK request.



20
21
22
23
24
25
26
27
28
29
30
# 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) ⇒ Object

Build an XML response for a PROPFIND request.



33
34
35
36
37
38
39
# 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) ⇒ Object

Build an XML response for a PROPPATCH request.



42
43
44
45
46
47
48
# 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