Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

method for locking, unlocking resources. #34

Open
ghost opened this issue Feb 12, 2015 · 5 comments
Open

method for locking, unlocking resources. #34

ghost opened this issue Feb 12, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Feb 12, 2015

Is there any method for locking, unlocking resources. I couldn't find it in dav.rb file

@thomasfl
Copy link
Collaborator

Locking and unlocking is supported. In dav.rb "lock" is one of the supported verbs.

@ghost
Copy link
Author

ghost commented Feb 12, 2015

fine, thanks! But when installed using gem 'net_dav', '~> 0.5.0' . It doesn't have those methods in dav.rb file.

@thomasfl
Copy link
Collaborator

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.

@ghost
Copy link
Author

ghost commented Feb 13, 2015

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.

@thomasfl
Copy link
Collaborator

Cool! Good luck.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant