webdav 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a68489cf05ff70988c883f17b41a303db682c85346c4aa27dbadf1cf9f8c869
4
- data.tar.gz: a3544d9e0bcdd1b9bbe05720e72a10613ec291280f20d3030521189a68281fb5
3
+ metadata.gz: 7cfb5917b6e243ee7cd320c11efe5d0e5f45f105e9582260f9ef78761527bca5
4
+ data.tar.gz: 6432520de31439361a82dece23d05c975eecf9d3bea3d5a445e676a8d191fc6f
5
5
  SHA512:
6
- metadata.gz: 48e20a5991a5093884a4009ae00c91d807953b158044e413b338aa2cfbccb228257b4128fcb98a128159436ecf541fe8d5cb291816ca9c48e77258589626149d
7
- data.tar.gz: 887a1baac0d7d8592da56894dc1e74b907ccd3ce69a92dbe87f8bef0e10cca9b58ea22e89447ff9682c6a8de09e920989c1d200450fdd2d13e03b358545c3580
6
+ metadata.gz: 626935fc1dce14e68d6f1f1df93a0a41e54c6fcbfdc68bf46dbce87d0908e5dd2b3dc5824b57737ad5cd7e85e3f3fc13bc22419d4c27cc94526d53d67f1996f7
7
+ data.tar.gz: a72ae5acc02837027b2297e7dd502d80b1f99e1baa0afe647999c75057ed03f62dbc3416e3fd11c7d78aee9fbf25763b2d4179220bce02336be8d3dde86dd391
data/CHANGELOG CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
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
+
3
13
  ## 20260508
4
14
 
5
15
  0.1.0: Remove Net::HTTP::Report; now provided by http.rb 0.18.0.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # webdav
2
2
 
3
- A Ruby WebDAV client library.
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
- ### REPORT
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
- ### WebDAV (RFC 4918 / RFC 3253)
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
- - `propfind(path, body:, depth:)` — Retrieve properties
97
- - `proppatch(path, body:)` — Modify properties
98
- - `report(path, body:, depth:)` — Run a report query
99
- - `mkcol(path)` — Create a collection
100
- - `copy(path, to:, depth:, overwrite:)` — Copy a resource
101
- - `move(path, to:, overwrite:)` — Move a resource
102
- - `lock(path, body:)` — Lock a resource
103
- - `unlock(path, token:)` — Unlock a resource
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
@@ -0,0 +1,16 @@
1
+ # Net/HTTP/Report.rb
2
+ # Net::HTTP::Report
3
+
4
+ require 'net/http'
5
+
6
+ module Net
7
+ class HTTP
8
+ class Report < Net::HTTPRequest
9
+
10
+ METHOD = 'REPORT'
11
+ REQUEST_HAS_BODY = true
12
+ RESPONSE_HAS_BODY = true
13
+
14
+ end
15
+ end
16
+ end
@@ -2,5 +2,5 @@
2
2
  # WebDAV::VERSION
3
3
 
4
4
  class WebDAV
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
data/lib/webdav.rb CHANGED
@@ -3,9 +3,9 @@
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
 
8
+ require_relative './Net/HTTP/Report'
9
9
  require_relative './String/to_const'
10
10
  require_relative './WebDAV/Error'
11
11
  require_relative './WebDAV/MultiStatus'
@@ -25,7 +25,7 @@ class WebDAV
25
25
  handle_response(response)
26
26
  end
27
27
 
28
- # Reports
28
+ # Versioning
29
29
 
30
30
  def report(path, body:, depth: '1')
31
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
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
@@ -62,6 +62,7 @@ files:
62
62
  - LICENSE
63
63
  - README.md
64
64
  - Rakefile
65
+ - lib/Net/HTTP/Report.rb
65
66
  - lib/String/to_const.rb
66
67
  - lib/Thoran/Array/AllButFirst/all_but_first.rb
67
68
  - lib/Thoran/Array/FirstX/firstX.rb
@@ -71,6 +72,7 @@ files:
71
72
  - lib/WebDAV/Response.rb
72
73
  - lib/WebDAV/VERSION.rb
73
74
  - lib/webdav.rb
75
+ - test/Net/HTTP/Report_test.rb
74
76
  - test/WebDAV/Error_test.rb
75
77
  - test/WebDAV/MultiStatus_test.rb
76
78
  - test/WebDAV/Response_test.rb