caldav.rb 0.0.0 → 0.0.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: 25dd8ca7b31b78c727d868379e569f2a9a1715ca4f00d7378aa0fdba1bf534aa
4
- data.tar.gz: fbd981192af07191ba341e9087966b509c04976fbb985d8152b0e1a67340198b
3
+ metadata.gz: cd83567be6a0888519587dec09f4c94aea73cf679f3f32156bb1faa5e47bfba5
4
+ data.tar.gz: efff3242239f80e621a790ddacdc94b8caf6d9e6f7c3ffe7f19b6831a595edef
5
5
  SHA512:
6
- metadata.gz: 69bb382d65bf98f71c1ccc3fad7b110a034edad6906efab5530b46ff3a4bcd0e78d0852864fadfa5c116c96b89803ed46e79755ba548fb817243b74287cc3e70
7
- data.tar.gz: e6c8231c951220f020b36d1b6330713fb31ecf5908b26c0e0e1190754f9bbd4159a70d518d39d83526e6e8f1ea33e529debaac8438c1dda6bff12456686202c1
6
+ metadata.gz: 888f26ce9164ee670b1ec54a4551e2d75978e851091100d8b90427fad5228f880be92dc33d3e16401a7eb3016420ad30a662e0d328fcbfe4ae76b87686cc0637
7
+ data.tar.gz: 132bf372fcd50edcbb2ea9de6b657b6595a020f8c30b2870ba5a26bee5541094b6eedc65b8a8c1cbb33068fd834e9fa109ee280e7143e21496801152b572e6b3
data/CHANGELOG CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 20260621
4
+
5
+ 0.0.1: Lowercase load file; require VERSION; MultiStatus tests.
6
+
7
+ 1. /CalDAV.rb/caldav.rb/
8
+ 2. ~ lib/caldav.rb: + require_relative './CalDAV/VERSION'
9
+ 3. ~ caldav.rb.gemspec description
10
+ 4. + CalDAV::MultiStatus unit test, covering the two overrides over WebDAV::MultiStatus: parse_response (wraps each response as a CalDAV::Resource, in order) and parse_properties (a pretty-printed nested property is kept as serialised markup rather than collapsing to inter-tag whitespace).
11
+ 5. ~ VERSION: /0.0.0/0.0.1/
12
+
3
13
  ## 20260620
4
14
 
5
15
  0.0.0: Initial release.
data/README.md CHANGED
@@ -28,7 +28,7 @@ caldav.rb is designed in three layers, each a strict superset of the one below.
28
28
  ## Usage
29
29
 
30
30
  ```ruby
31
- require 'caldav'
31
+ require 'caldav.rb'
32
32
 
33
33
  caldav = CalDAV.new('https://caldav.example.com/dav/', username: 'user', password: 'pass')
34
34
  ```
data/caldav.rb.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.version = CalDAV::VERSION
16
16
 
17
17
  spec.summary = "A Ruby CalDAV client library."
18
- spec.description = "A Ruby CalDAV client library, built on webdav (RFC 4791)."
18
+ spec.description = "A Ruby CalDAV client library (RFC 4791)."
19
19
 
20
20
  spec.author = 'thoran'
21
21
  spec.email = 'code@thoran.com'
@@ -4,5 +4,5 @@
4
4
  class WebDAV; end
5
5
 
6
6
  class CalDAV < WebDAV
7
- VERSION = '0.0.0'
7
+ VERSION = '0.0.1'
8
8
  end
@@ -3,8 +3,9 @@
3
3
 
4
4
  require 'webdav'
5
5
 
6
- require_relative './CalDAV/Resource'
7
6
  require_relative './CalDAV/MultiStatus'
7
+ require_relative './CalDAV/Resource'
8
+ require_relative './CalDAV/VERSION'
8
9
  require_relative './Net/HTTP/Mkcalendar'
9
10
 
10
11
  class CalDAV < WebDAV
@@ -0,0 +1,61 @@
1
+ # test/CalDAV/MultiStatus_test.rb
2
+
3
+ require_relative '../helper'
4
+
5
+ describe CalDAV::MultiStatus do
6
+ let(:body) do
7
+ <<~XML
8
+ <?xml version="1.0" encoding="UTF-8"?>
9
+ <d:multistatus xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
10
+ <d:response>
11
+ <d:href>/calendars/user/work/</d:href>
12
+ <d:propstat>
13
+ <d:prop>
14
+ <d:resourcetype>
15
+ <d:collection/>
16
+ <c:calendar/>
17
+ </d:resourcetype>
18
+ <c:calendar-description>Work calendar</c:calendar-description>
19
+ </d:prop>
20
+ <d:status>HTTP/1.1 200 OK</d:status>
21
+ </d:propstat>
22
+ </d:response>
23
+ <d:response>
24
+ <d:href>/calendars/user/home/</d:href>
25
+ <d:propstat>
26
+ <d:prop>
27
+ <d:resourcetype>
28
+ <d:collection/>
29
+ <c:calendar/>
30
+ </d:resourcetype>
31
+ </d:prop>
32
+ <d:status>HTTP/1.1 200 OK</d:status>
33
+ </d:propstat>
34
+ </d:response>
35
+ </d:multistatus>
36
+ XML
37
+ end
38
+ let(:multistatus){CalDAV::MultiStatus.new(MockResponse.new(code: '207', message: 'Multi-Status', body: body))}
39
+ let(:work){multistatus.resources[0]}
40
+ let(:work_properties){work.propstats.first[:properties]}
41
+
42
+ it "parses one resource per response element" do
43
+ _(multistatus.resources.size).must_equal 2
44
+ end
45
+
46
+ it "wraps every response as a CalDAV::Resource" do
47
+ _(multistatus.resources.map(&:class).uniq).must_equal [CalDAV::Resource]
48
+ end
49
+
50
+ it "preserves response order" do
51
+ _(multistatus.resources.collect(&:href)).must_equal ['/calendars/user/work/', '/calendars/user/home/']
52
+ end
53
+
54
+ it "keeps a pretty-printed nested property as serialised markup, not whitespace" do
55
+ _(work_properties[CalDAV::DAV_NAMESPACE]['resourcetype']).must_match(%r{<(?:\w+:)?calendar})
56
+ end
57
+
58
+ it "keeps a flat property's text" do
59
+ _(work_properties[CalDAV::NAMESPACE]['calendar-description']).must_equal 'Work calendar'
60
+ end
61
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caldav.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
@@ -93,7 +93,7 @@ dependencies:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '3.0'
96
- description: A Ruby CalDAV client library, built on webdav (RFC 4791).
96
+ description: A Ruby CalDAV client library (RFC 4791).
97
97
  email: code@thoran.com
98
98
  executables: []
99
99
  extensions: []
@@ -105,14 +105,15 @@ files:
105
105
  - README.md
106
106
  - Rakefile
107
107
  - caldav.rb.gemspec
108
- - lib/CalDAV.rb
109
108
  - lib/CalDAV/MultiStatus.rb
110
109
  - lib/CalDAV/Resource.rb
111
110
  - lib/CalDAV/VERSION.rb
112
111
  - lib/Net/HTTP/Mkcalendar.rb
112
+ - lib/caldav.rb
113
+ - test/CalDAV/MultiStatus_test.rb
113
114
  - test/CalDAV/Resource_test.rb
114
- - test/CalDAV_test.rb
115
115
  - test/Net/HTTP/Mkcalendar_test.rb
116
+ - test/caldav_test.rb
116
117
  - test/helper.rb
117
118
  - test/integration_test.rb
118
119
  - test/vcr_helper.rb
File without changes