Class: Calligraphy::XML::Builder
- Inherits:
-
Object
- Object
- Calligraphy::XML::Builder
- Defined in:
- lib/calligraphy/xml/builder.rb
Constant Summary collapse
- SUPPORTED_NS_TAGS =
%w( creationdate displayname exclusive getcontentlanguage getcontentlength getcontenttype getetag getlastmodified href lockdiscovery lockscope locktype owner write )- DAV_PROPERTIES =
%w( creationdate displayname getcontentlanguage getcontentlength getcontenttype getetag getlastmodified lockdiscovery resourcetype supportedlock )
Instance Attribute Summary collapse
-
#dav_ns ⇒ Object
readonly
Returns the value of attribute dav_ns.
-
#default_ns ⇒ Object
readonly
Returns the value of attribute default_ns.
-
#server_protocol ⇒ Object
readonly
Returns the value of attribute server_protocol.
Instance Method Summary collapse
-
#initialize(dav_ns: 'D', server_protocol: 'HTTP/1.1') ⇒ Builder
constructor
A new instance of Builder.
- #lock_res(activelock_properties) ⇒ Object
- #propfind_res(path, properties) ⇒ Object
- #proppatch_res(path, actions) ⇒ Object
Constructor Details
#initialize(dav_ns: 'D', server_protocol: 'HTTP/1.1') ⇒ Builder
Returns a new instance of Builder.
16 17 18 19 20 |
# File 'lib/calligraphy/xml/builder.rb', line 16 def initialize(dav_ns: 'D', server_protocol: 'HTTP/1.1') @dav_ns = dav_ns @default_ns = { "xmlns:#{@dav_ns}" => 'DAV:' } @server_protocol = server_protocol end |
Instance Attribute Details
#dav_ns ⇒ Object (readonly)
Returns the value of attribute dav_ns.
14 15 16 |
# File 'lib/calligraphy/xml/builder.rb', line 14 def dav_ns @dav_ns end |
#default_ns ⇒ Object (readonly)
Returns the value of attribute default_ns.
14 15 16 |
# File 'lib/calligraphy/xml/builder.rb', line 14 def default_ns @default_ns end |
#server_protocol ⇒ Object (readonly)
Returns the value of attribute server_protocol.
14 15 16 |
# File 'lib/calligraphy/xml/builder.rb', line 14 def server_protocol @server_protocol end |
Instance Method Details
#lock_res(activelock_properties) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/calligraphy/xml/builder.rb', line 22 def lock_res(activelock_properties) build :prop do |xml| xml.lockdiscovery do activelock_properties.each do |properties| activelock xml, properties end end end end |
#propfind_res(path, properties) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/calligraphy/xml/builder.rb', line 32 def propfind_res(path, properties) multistatus do |xml| href xml, path propstat xml, properties[:found], :ok propstat xml, properties[:not_found], :not_found end end |
#proppatch_res(path, actions) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/calligraphy/xml/builder.rb', line 40 def proppatch_res(path, actions) multistatus do |xml| href xml, path propstat xml, actions[:set] propstat xml, actions[:remove] end end |