lib/net/dav.rb in net_dav-0.3.2 vs lib/net/dav.rb in net_dav-0.3.3
- old
+ new
@@ -369,10 +369,11 @@
# puts "#{item.type} #{item.uri}"
# puts item.content
# end
# end
def find(path, options = {})
+ path = @uri.merge(path).path
namespaces = {'x' => "DAV:"}
doc = propfind(path)
path.sub!(/\/$/, '')
doc./('.//x:response', namespaces).each do |item|
uri = @uri.merge(item.xpath("x:href", namespaces).inner_text)
@@ -410,10 +411,11 @@
# entity body in turn as a string as it is read from
# the socket. Note that in this case, the returned response
# object will *not* contain a (meaningful) body.
def get(path, &block)
+ path = @uri.merge(path).path
body = @handler.request_returning_body(:get, path, nil, &block)
body
end
# Stores the content of a stream to a URL
@@ -421,26 +423,29 @@
# Example:
# File.open(file, "r") do |stream|
# dav.put(url.path, stream, File.size(file))
# end
def put(path, stream, length)
+ path = @uri.merge(path).path
res = @handler.request_sending_stream(:put, path, stream, length, nil)
res.body
end
# Stores the content of a string to a URL
#
# Example:
# dav.put(url.path, "hello world")
#
def put_string(path, str)
+ path = @uri.merge(path).path
res = @handler.request_sending_body(:put, path, str, nil)
res.body
end
# Makes a new directory (collection)
def mkdir(path)
+ path = @uri.merge(path).path
res = @handler.request(:mkcol, path, nil, nil)
res.body
end
def verify_callback=(callback)