Class: WebDAV

Inherits:
Object
  • Object
show all
Defined in:
lib/WebDAV/Error.rb,
lib/webdav.rb,
lib/WebDAV/VERSION.rb,
lib/WebDAV/Response.rb,
lib/WebDAV/MultiStatus.rb

Overview

WebDAV/Response.rb WebDAV::Response.rb

Defined Under Namespace

Classes: Error, MultiStatus, Response

Constant Summary collapse

VERSION =
'0.0.0'

Instance Method Summary collapse

Instance Method Details

#copy(path, to:, depth: 'infinity', overwrite: true) ⇒ Object

Namespace



45
46
47
48
49
50
51
52
# File 'lib/webdav.rb', line 45

def copy(path, to:, depth: 'infinity', overwrite: true)
  response = request(:copy, path, headers: {
    'Destination' => resolve_uri(to).to_s,
    'Depth' => depth,
    'Overwrite' => overwrite ? 'T' : 'F'
  })
  handle_response(response)
end

#delete(path) ⇒ Object



101
102
103
104
# File 'lib/webdav.rb', line 101

def delete(path)
  response = request(:delete, path)
  handle_response(response)
end

#get(path) ⇒ Object

Standard HTTP



76
77
78
79
# File 'lib/webdav.rb', line 76

def get(path)
  response = request(:get, path)
  handle_response(response)
end

#head(path) ⇒ Object



81
82
83
84
# File 'lib/webdav.rb', line 81

def head(path)
  response = request(:head, path)
  handle_response(response)
end

#lock(path, body:) ⇒ Object

Locking



64
65
66
67
# File 'lib/webdav.rb', line 64

def lock(path, body:)
  response = request(:lock, path, body: body)
  handle_response(response)
end

#mkcol(path) ⇒ Object

Collections



38
39
40
41
# File 'lib/webdav.rb', line 38

def mkcol(path)
  response = request(:mkcol, path)
  handle_response(response)
end

#move(path, to:, overwrite: true) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/webdav.rb', line 54

def move(path, to:, overwrite: true)
  response = request(:move, path, headers: {
    'Destination' => resolve_uri(to).to_s,
    'Overwrite' => overwrite ? 'T' : 'F'
  })
  handle_response(response)
end

#options(path = '/') ⇒ Object



106
107
108
109
# File 'lib/webdav.rb', line 106

def options(path = '/')
  response = request(:options, path)
  handle_response(response)
end

#patch(path, body:, content_type: 'application/xml') ⇒ Object



96
97
98
99
# File 'lib/webdav.rb', line 96

def patch(path, body:, content_type: 'application/xml')
  response = request(:patch, path, body: body, headers: {'Content-Type' => content_type})
  handle_response(response)
end

#post(path, body:, content_type: 'application/xml') ⇒ Object



86
87
88
89
# File 'lib/webdav.rb', line 86

def post(path, body:, content_type: 'application/xml')
  response = request(:post, path, body: body, headers: {'Content-Type' => content_type})
  handle_response(response)
end

#propfind(path = '/', body: nil, depth: '1') ⇒ Object

Properties



19
20
21
22
# File 'lib/webdav.rb', line 19

def propfind(path = '/', body: nil, depth: '1')
  response = request(:propfind, path, body: body, headers: {'Depth' => depth})
  handle_response(response)
end

#proppatch(path, body:) ⇒ Object



24
25
26
27
# File 'lib/webdav.rb', line 24

def proppatch(path, body:)
  response = request(:proppatch, path, body: body)
  handle_response(response)
end

#put(path, body:, content_type: 'application/octet-stream') ⇒ Object



91
92
93
94
# File 'lib/webdav.rb', line 91

def put(path, body:, content_type: 'application/octet-stream')
  response = request(:put, path, body: body, headers: {'Content-Type' => content_type})
  handle_response(response)
end

#report(path, body:, depth: '1') ⇒ Object

Reports



31
32
33
34
# File 'lib/webdav.rb', line 31

def report(path, body:, depth: '1')
  response = request(:report, path, body: body, headers: {'Depth' => depth})
  handle_response(response)
end

#trace(path) ⇒ Object



111
112
113
114
# File 'lib/webdav.rb', line 111

def trace(path)
  response = request(:trace, path)
  handle_response(response)
end

#unlock(path, token:) ⇒ Object



69
70
71
72
# File 'lib/webdav.rb', line 69

def unlock(path, token:)
  response = request(:unlock, path, headers: {'Lock-Token' => "<#{token}>"})
  handle_response(response)
end