webdav 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +34 -0
- data/README.md +47 -14
- data/Rakefile +9 -0
- data/lib/WebDAV/MultiStatus.rb +2 -0
- data/lib/WebDAV/VERSION.rb +1 -1
- data/lib/webdav.rb +1 -2
- data/test/Net/HTTP/Report_test.rb +21 -0
- data/webdav.gemspec +22 -4
- metadata +34 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cfb5917b6e243ee7cd320c11efe5d0e5f45f105e9582260f9ef78761527bca5
|
|
4
|
+
data.tar.gz: 6432520de31439361a82dece23d05c975eecf9d3bea3d5a445e676a8d191fc6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 626935fc1dce14e68d6f1f1df93a0a41e54c6fcbfdc68bf46dbce87d0908e5dd2b3dc5824b57737ad5cd7e85e3f3fc13bc22419d4c27cc94526d53d67f1996f7
|
|
7
|
+
data.tar.gz: a72ae5acc02837027b2297e7dd502d80b1f99e1baa0afe647999c75057ed03f62dbc3416e3fd11c7d78aee9fbf25763b2d4179220bce02336be8d3dde86dd391
|
data/CHANGELOG
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
# 20260508
|
|
4
|
+
|
|
5
|
+
0.1.1: Reinstate Net::HTTP::Report.
|
|
6
|
+
|
|
7
|
+
1. + lib/Net/HTTP/Report.rb: Reinstated after checking after it was incorrectly removed in 0.1.0. REPORT is from RFC 3253 (WebDAV versioning) and is not a core HTTP method.
|
|
8
|
+
2. ~ lib/webdav.rb: + require_relative './Net/HTTP/Report'
|
|
9
|
+
3. + test/Net/HTTP/Report_test.rb
|
|
10
|
+
4. ~ WebDAV::VERSION: /0.1.0/0.1.1/
|
|
11
|
+
5. ~ CHANGELOG: + 0.1.1
|
|
12
|
+
|
|
13
|
+
## 20260508
|
|
14
|
+
|
|
15
|
+
0.1.0: Remove Net::HTTP::Report; now provided by http.rb 0.18.0.
|
|
16
|
+
|
|
17
|
+
1. - lib/Net/HTTP/Report.rb: Now provided by http.rb 0.18.0.
|
|
18
|
+
2. ~ lib/webdav.rb: - require_relative './Net/HTTP/Report'
|
|
19
|
+
3. ~ webdav.gemspec: Pin http.rb dependency to >= 0.18.0; + development dependencies; + CHANGELOG and Rakefile to files; reformat.
|
|
20
|
+
4. ~ .gitignore: Previously empty. Now with a default and comprehensive set of defaults.
|
|
21
|
+
5. ~ WebDAV::VERSION: /0.0.0/0.1.0/
|
|
22
|
+
6. ~ lib/webdav.rb: - require 'rexml/document'
|
|
23
|
+
7. ~ lib/WebDAV/MultiStatus.rb: + require 'rexml/document'
|
|
24
|
+
|
|
25
|
+
## 20260325
|
|
26
|
+
|
|
27
|
+
0.0.0: Initial release.
|
|
28
|
+
|
|
29
|
+
1. + WebDAV client with 16 verbs
|
|
30
|
+
a. 8 WebDAV-specific verbs: copy, lock, mkcol, move, propfind, proppatch, report, unlock.
|
|
31
|
+
b. 8 standard HTTP verbs: delete, get, head, options, patch, post, put, and trace.
|
|
32
|
+
2. + WebDAV::Response response object
|
|
33
|
+
3. + WebDAV::MultiStatus response object
|
|
34
|
+
4. + WebDAV::Error for 4xx/5xx responses
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# webdav
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A WebDAV client library for Ruby.
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
## Installation
|
|
6
7
|
|
|
@@ -14,6 +15,7 @@ Or in your Gemfile:
|
|
|
14
15
|
gem 'webdav'
|
|
15
16
|
```
|
|
16
17
|
|
|
18
|
+
|
|
17
19
|
## Usage
|
|
18
20
|
|
|
19
21
|
```ruby
|
|
@@ -80,7 +82,7 @@ response = dav.lock('/documents/report.txt', body: lock_body)
|
|
|
80
82
|
dav.unlock('/documents/report.txt', token: 'urn:uuid:...')
|
|
81
83
|
```
|
|
82
84
|
|
|
83
|
-
###
|
|
85
|
+
### Reporting
|
|
84
86
|
|
|
85
87
|
```ruby
|
|
86
88
|
response = dav.report('/calendars/user/', body: report_xml, depth: '1')
|
|
@@ -89,18 +91,37 @@ response.resources.each do |resource|
|
|
|
89
91
|
end
|
|
90
92
|
```
|
|
91
93
|
|
|
92
|
-
## Verbs
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
## Methods
|
|
96
|
+
|
|
97
|
+
WebDAV extends HTTP with additional methods for distributed authoring. This gem provides all the methods defined in RFC 4918 ("HTTP Extensions for Web Distributed Authoring and Versioning") and the REPORT method from RFC 3253 ("Versioning Extensions to WebDAV"), which is essential for CalDAV and CardDAV queries.
|
|
98
|
+
|
|
99
|
+
Ruby's standard library includes request classes for the RFC 4918 methods (Propfind, Proppatch, Mkcol, Copy, Move, Lock, Unlock) but not for REPORT. This gem defines `Net::HTTP::Report` to fill that gap.
|
|
100
|
+
|
|
101
|
+
These methods are not provided by the `http.rb` gem, which deliberately limits itself to the core HTTP methods defined in RFC 9110 ("HTTP Semantics") and RFC 5789 ("PATCH Method for HTTP").
|
|
102
|
+
|
|
103
|
+
### Properties (RFC 4918)
|
|
104
|
+
|
|
105
|
+
- `propfind(path, body:, depth:)` — retrieve properties from a resource
|
|
106
|
+
- `proppatch(path, body:)` — set or remove properties on a resource
|
|
107
|
+
|
|
108
|
+
### Versioning (RFC 3253)
|
|
109
|
+
|
|
110
|
+
- `report(path, body:, depth:)` — query for information about a resource; used by CalDAV and CardDAV
|
|
111
|
+
|
|
112
|
+
### Collections (RFC 4918)
|
|
113
|
+
|
|
114
|
+
- `mkcol(path)` — create a new collection (directory)
|
|
95
115
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- `
|
|
99
|
-
- `
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- `
|
|
116
|
+
### Namespace (RFC 4918)
|
|
117
|
+
|
|
118
|
+
- `copy(path, to:, depth:, overwrite:)` — copy a resource
|
|
119
|
+
- `move(path, to:, overwrite:)` — move a resource
|
|
120
|
+
|
|
121
|
+
### Locking (RFC 4918)
|
|
122
|
+
|
|
123
|
+
- `lock(path, body:)` — lock a resource
|
|
124
|
+
- `unlock(path, token:)` — unlock a resource
|
|
104
125
|
|
|
105
126
|
### Standard HTTP
|
|
106
127
|
|
|
@@ -113,6 +134,7 @@ end
|
|
|
113
134
|
- `options(path)`
|
|
114
135
|
- `trace(path)`
|
|
115
136
|
|
|
137
|
+
|
|
116
138
|
## Responses
|
|
117
139
|
|
|
118
140
|
All methods return either a `WebDAV::Response` or a `WebDAV::MultiStatus`.
|
|
@@ -129,20 +151,31 @@ All methods return either a `WebDAV::Response` or a `WebDAV::MultiStatus`.
|
|
|
129
151
|
|
|
130
152
|
`WebDAV::MultiStatus` additionally provides:
|
|
131
153
|
|
|
132
|
-
- `resources`
|
|
133
|
-
— an array of hashes, each with:
|
|
154
|
+
- `resources` — an array of hashes, each with:
|
|
134
155
|
- `href`
|
|
135
156
|
- `properties`
|
|
136
157
|
- `status`
|
|
137
158
|
|
|
159
|
+
|
|
138
160
|
## Errors
|
|
139
161
|
|
|
140
162
|
Responses with status >= 400 raise `WebDAV::Error`, which has `code`, `message`, and `body`.
|
|
141
163
|
|
|
164
|
+
|
|
142
165
|
## Dependencies
|
|
143
166
|
|
|
144
167
|
- [http.rb](https://github.com/thoran/http.rb)
|
|
145
168
|
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
1. Fork it [https://github.com/thoran/webdav/fork](https://github.com/thoran/webdav/fork)
|
|
173
|
+
2. Create your feature branch (git checkout -b my-new-feature)
|
|
174
|
+
3. Commit your changes (git commit -am 'Add some feature')
|
|
175
|
+
4. Push to the branch (git push origin my-new-feature)
|
|
176
|
+
5. Create a new pull request
|
|
177
|
+
|
|
178
|
+
|
|
146
179
|
## Licence
|
|
147
180
|
|
|
148
181
|
MIT
|
data/Rakefile
ADDED
data/lib/WebDAV/MultiStatus.rb
CHANGED
data/lib/WebDAV/VERSION.rb
CHANGED
data/lib/webdav.rb
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
gem 'http.rb'; require 'http.rb'
|
|
5
5
|
require 'net/http'
|
|
6
|
-
require 'rexml/document'
|
|
7
6
|
require 'uri'
|
|
8
7
|
|
|
9
8
|
require_relative './Net/HTTP/Report'
|
|
@@ -26,7 +25,7 @@ class WebDAV
|
|
|
26
25
|
handle_response(response)
|
|
27
26
|
end
|
|
28
27
|
|
|
29
|
-
#
|
|
28
|
+
# Versioning
|
|
30
29
|
|
|
31
30
|
def report(path, body:, depth: '1')
|
|
32
31
|
response = request(:report, path, body: body, headers: {'Depth' => depth})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# test/Net/HTTP/Report_test.rb
|
|
2
|
+
|
|
3
|
+
require_relative '../../helper'
|
|
4
|
+
|
|
5
|
+
describe Net::HTTP::Report do
|
|
6
|
+
it "is a subclass of Net::HTTPRequest" do
|
|
7
|
+
_(Net::HTTP::Report < Net::HTTPRequest).must_equal(true)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "has the correct METHOD" do
|
|
11
|
+
_(Net::HTTP::Report::METHOD).must_equal('REPORT')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "accepts a body" do
|
|
15
|
+
_(Net::HTTP::Report::REQUEST_HAS_BODY).must_equal(true)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "expects a response body" do
|
|
19
|
+
_(Net::HTTP::Report::RESPONSE_HAS_BODY).must_equal(true)
|
|
20
|
+
end
|
|
21
|
+
end
|
data/webdav.gemspec
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
require_relative './lib/WebDAV/VERSION'
|
|
2
2
|
|
|
3
|
+
class Gem::Specification
|
|
4
|
+
def dependencies=(gems)
|
|
5
|
+
gems.each{|gem| add_dependency(*gem)}
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def development_dependencies=(gems)
|
|
9
|
+
gems.each{|gem| add_development_dependency(*gem)}
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
3
13
|
Gem::Specification.new do |spec|
|
|
4
14
|
spec.name = 'webdav'
|
|
5
15
|
spec.version = WebDAV::VERSION
|
|
@@ -13,17 +23,25 @@ Gem::Specification.new do |spec|
|
|
|
13
23
|
spec.license = 'MIT'
|
|
14
24
|
|
|
15
25
|
spec.required_ruby_version = '>= 2.7'
|
|
16
|
-
|
|
17
|
-
spec.add_dependency('http.rb')
|
|
26
|
+
spec.require_paths = ['lib']
|
|
18
27
|
|
|
19
28
|
spec.files = [
|
|
20
29
|
'webdav.gemspec',
|
|
30
|
+
'CHANGELOG',
|
|
21
31
|
'Gemfile',
|
|
22
|
-
Dir['lib/**/*.rb'],
|
|
23
32
|
'LICENSE',
|
|
33
|
+
'Rakefile',
|
|
24
34
|
'README.md',
|
|
35
|
+
Dir['lib/**/*.rb'],
|
|
25
36
|
Dir['test/**/*.rb']
|
|
26
37
|
].flatten
|
|
27
38
|
|
|
28
|
-
spec.
|
|
39
|
+
spec.dependencies = [
|
|
40
|
+
['http.rb', '>= 0.18.0']
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
spec.development_dependencies = %w{
|
|
44
|
+
minitest
|
|
45
|
+
rake
|
|
46
|
+
}
|
|
29
47
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: webdav
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -15,9 +15,37 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 0.18.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.18.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: minitest
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rake
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
21
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
50
|
requirements:
|
|
23
51
|
- - ">="
|
|
@@ -29,9 +57,11 @@ executables: []
|
|
|
29
57
|
extensions: []
|
|
30
58
|
extra_rdoc_files: []
|
|
31
59
|
files:
|
|
60
|
+
- CHANGELOG
|
|
32
61
|
- Gemfile
|
|
33
62
|
- LICENSE
|
|
34
63
|
- README.md
|
|
64
|
+
- Rakefile
|
|
35
65
|
- lib/Net/HTTP/Report.rb
|
|
36
66
|
- lib/String/to_const.rb
|
|
37
67
|
- lib/Thoran/Array/AllButFirst/all_but_first.rb
|
|
@@ -42,6 +72,7 @@ files:
|
|
|
42
72
|
- lib/WebDAV/Response.rb
|
|
43
73
|
- lib/WebDAV/VERSION.rb
|
|
44
74
|
- lib/webdav.rb
|
|
75
|
+
- test/Net/HTTP/Report_test.rb
|
|
45
76
|
- test/WebDAV/Error_test.rb
|
|
46
77
|
- test/WebDAV/MultiStatus_test.rb
|
|
47
78
|
- test/WebDAV/Response_test.rb
|
|
@@ -66,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
97
|
- !ruby/object:Gem::Version
|
|
67
98
|
version: '0'
|
|
68
99
|
requirements: []
|
|
69
|
-
rubygems_version: 4.0.
|
|
100
|
+
rubygems_version: 4.0.11
|
|
70
101
|
specification_version: 4
|
|
71
102
|
summary: A Ruby WebDAV client library.
|
|
72
103
|
test_files: []
|