net_dav
net_dav copied to clipboard
method for locking, unlocking resources.
Is there any method for locking, unlocking resources. I couldn't find it in dav.rb file
Locking and unlocking is supported. In dav.rb "lock" is one of the supported verbs.
fine, thanks! But when installed using gem 'net_dav', '~> 0.5.0' . It doesn't have those methods in dav.rb file.
You have the latest release of net_dav.
require 'rubygems'
require 'net/dav'
require 'uri'
dav = Net::DAV.new('http://www.example.com/')
dav.credentials(ENV['DAVUSER'],ENV['DAVPASS'])
uri = URI.parse('http://www.example.com/unlocked_file.txt')
dav.lock(uri.path, "<d:lockscope><d:exclusive/></d:lockscope><d:locktype><d:write/></d:locktype><d:owner>Owner</d:owner>")
dav.unlock(uri.path, "opaquelocktoken:<insert token here>")
I recommend you add pry to your code to start a irb like shell, and experiment a little
require 'pry'
binding.pry
I don't work with WebDAV servers anymore, so I would have to install a server to be able to create some sample code.
thanks @thomasfl , When I looked for lock, unlock method in dav.rb file in my local machine. I couldn't find. But it is available in github. so i used it.
Cool! Good luck.