sabredav_client 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -3
  3. data/.rspec +1 -1
  4. data/CHANGELOG.rdoc +8 -8
  5. data/Gemfile +3 -3
  6. data/Gemfile.lock +38 -39
  7. data/README.md +49 -49
  8. data/Rakefile +5 -5
  9. data/lib/sabredav_client.rb +10 -10
  10. data/lib/sabredav_client/calendar.rb +174 -171
  11. data/lib/sabredav_client/client.rb +57 -57
  12. data/lib/sabredav_client/errors/errors.rb +41 -41
  13. data/lib/sabredav_client/events.rb +106 -106
  14. data/lib/sabredav_client/net.rb +15 -15
  15. data/lib/sabredav_client/principal.rb +51 -51
  16. data/lib/sabredav_client/request.rb +97 -97
  17. data/lib/sabredav_client/version.rb +3 -3
  18. data/lib/sabredav_client/xml_request_builder.rb +7 -7
  19. data/lib/sabredav_client/xml_request_builder/base.rb +17 -17
  20. data/lib/sabredav_client/xml_request_builder/mkcalendar.rb +25 -25
  21. data/lib/sabredav_client/xml_request_builder/mkcol_principal.rb +28 -28
  22. data/lib/sabredav_client/xml_request_builder/post_sharing.rb +41 -41
  23. data/lib/sabredav_client/xml_request_builder/propfind_calendar.rb +41 -41
  24. data/lib/sabredav_client/xml_request_builder/propfind_invite.rb +19 -19
  25. data/lib/sabredav_client/xml_request_builder/propfind_owner.rb +19 -19
  26. data/lib/sabredav_client/xml_request_builder/proppatch_calendar.rb +25 -25
  27. data/lib/sabredav_client/xml_request_builder/proppatch_events_owner.rb +23 -23
  28. data/lib/sabredav_client/xml_request_builder/proppatch_principal.rb +25 -25
  29. data/lib/sabredav_client/xml_request_builder/report_event_changes.rb +22 -22
  30. data/lib/sabredav_client/xml_request_builder/report_vevent.rb +30 -30
  31. data/lib/sabredav_client/xml_request_builder/report_vtodo.rb +20 -20
  32. data/sabredav_client.gemspec +31 -31
  33. data/spec/fixtures/calendar_fetch_changes.xml +26 -26
  34. data/spec/fixtures/calendar_info.xml +14 -14
  35. data/spec/fixtures/calendar_sharees.xml +35 -35
  36. data/spec/fixtures/calendar_sharees_without_common_name.xml +26 -26
  37. data/spec/fixtures/event.ics +23 -23
  38. data/spec/fixtures/events_find_multiple.xml +51 -51
  39. data/spec/fixtures/events_owner.xml +12 -12
  40. data/spec/fixtures/xml_request_builder/mkcalendar.xml +9 -9
  41. data/spec/fixtures/xml_request_builder/mkcol_principal.xml +12 -12
  42. data/spec/fixtures/xml_request_builder/post_sharing.xml +18 -18
  43. data/spec/fixtures/xml_request_builder/propfind_calendar/all_properties.xml +8 -8
  44. data/spec/fixtures/xml_request_builder/propfind_invite.xml +6 -6
  45. data/spec/fixtures/xml_request_builder/propfind_owner.xml +6 -6
  46. data/spec/fixtures/xml_request_builder/proppatch_calendar.xml +9 -9
  47. data/spec/fixtures/xml_request_builder/proppatch_events_owner.xml +8 -8
  48. data/spec/fixtures/xml_request_builder/proppatch_principal.xml +9 -9
  49. data/spec/fixtures/xml_request_builder/report_event_changes.xml +8 -8
  50. data/spec/sabredav_client/calendar_spec.rb +142 -142
  51. data/spec/sabredav_client/client_spec.rb +41 -41
  52. data/spec/sabredav_client/events_spec.rb +119 -119
  53. data/spec/sabredav_client/principal_spec.rb +51 -51
  54. data/spec/sabredav_client/request_spec.rb +55 -55
  55. data/spec/sabredav_client/xml_request_builder_specs/base_spec.rb +30 -30
  56. data/spec/sabredav_client/xml_request_builder_specs/mkcalendar_spec.rb +13 -13
  57. data/spec/sabredav_client/xml_request_builder_specs/mkcol_principal_spec.rb +13 -13
  58. data/spec/sabredav_client/xml_request_builder_specs/post_sharing_spec.rb +15 -15
  59. data/spec/sabredav_client/xml_request_builder_specs/propfind_calendar_spec.rb +24 -24
  60. data/spec/sabredav_client/xml_request_builder_specs/propfind_invite_spec.rb +14 -14
  61. data/spec/sabredav_client/xml_request_builder_specs/propfind_owner_spec.rb +14 -14
  62. data/spec/sabredav_client/xml_request_builder_specs/proppatch_calendar.rb +15 -15
  63. data/spec/sabredav_client/xml_request_builder_specs/proppatch_events_owner_spec.rb +14 -14
  64. data/spec/sabredav_client/xml_request_builder_specs/proppatch_principal_spec.rb +24 -24
  65. data/spec/sabredav_client/xml_request_builder_specs/report_event_changes_spec.rb +15 -15
  66. data/spec/spec.opts +4 -4
  67. data/spec/spec_helper.rb +8 -8
  68. metadata +6 -5
@@ -1,19 +1,19 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class PropfindInvite < Base
5
-
6
- def initialize
7
- super()
8
- end
9
-
10
- def to_xml
11
- xml.d :propfind, CS_NAMESPACES do
12
- xml.d :prop do
13
- xml.cs :invite
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class PropfindInvite < Base
5
+
6
+ def initialize
7
+ super()
8
+ end
9
+
10
+ def to_xml
11
+ xml.d :propfind, CS_NAMESPACES do
12
+ xml.d :prop do
13
+ xml.cs :invite
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,19 +1,19 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class PropfindOwner < Base
5
-
6
- def initialize
7
- super()
8
- end
9
-
10
- def to_xml
11
- xml.d :propfind, CS_NAMESPACES do
12
- xml.d :prop do
13
- xml.cs :objectOwner
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class PropfindOwner < Base
5
+
6
+ def initialize
7
+ super()
8
+ end
9
+
10
+ def to_xml
11
+ xml.d :propfind, CS_NAMESPACES do
12
+ xml.d :prop do
13
+ xml.cs :objectOwner
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,25 +1,25 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class ProppatchCalendar < Base
5
- attr_accessor :displayname, :description
6
-
7
- def initialize(displayname = nil, description = nil)
8
- @displayname = displayname
9
- @description = description
10
- super()
11
- end
12
-
13
- def to_xml
14
- xml.d :propertyupdate, C_NAMESPACES do
15
- xml.d :set do
16
- xml.d :prop do
17
- xml.d :displayname, displayname unless displayname.nil?
18
- xml.tag! "c:calendar-description", description unless description.nil?
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class ProppatchCalendar < Base
5
+ attr_accessor :displayname, :description
6
+
7
+ def initialize(displayname = nil, description = nil)
8
+ @displayname = displayname
9
+ @description = description
10
+ super()
11
+ end
12
+
13
+ def to_xml
14
+ xml.d :propertyupdate, C_NAMESPACES do
15
+ xml.d :set do
16
+ xml.d :prop do
17
+ xml.d :displayname, displayname unless displayname.nil?
18
+ xml.tag! "c:calendar-description", description unless description.nil?
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,23 +1,23 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class ProppatchEventsOwner < Base
5
- attr_accessor :owner
6
-
7
- def initialize(owner)
8
- @owner = owner
9
- super()
10
- end
11
-
12
- def to_xml
13
- xml.d :propertyupdate, CS_NAMESPACES do
14
- xml.d :set do
15
- xml.d :prop do
16
- xml.cs :objectOwner, owner
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class ProppatchEventsOwner < Base
5
+ attr_accessor :owner
6
+
7
+ def initialize(owner)
8
+ @owner = owner
9
+ super()
10
+ end
11
+
12
+ def to_xml
13
+ xml.d :propertyupdate, CS_NAMESPACES do
14
+ xml.d :set do
15
+ xml.d :prop do
16
+ xml.cs :objectOwner, owner
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,25 +1,25 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class ProppatchPrincipal < Base
5
- attr_accessor :email, :displayname
6
-
7
- def initialize(email, displayname)
8
- @email = email
9
- @displayname = displayname
10
- super()
11
- end
12
-
13
- def to_xml
14
- xml.d :propertyupdate, SB_NAMESPACES do
15
- xml.d :set do
16
- xml.d :prop do
17
- xml.tag! "sb:email-address", email unless email.empty?
18
- xml.d :displayname, displayname unless displayname.empty?
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class ProppatchPrincipal < Base
5
+ attr_accessor :email, :displayname
6
+
7
+ def initialize(email, displayname)
8
+ @email = email
9
+ @displayname = displayname
10
+ super()
11
+ end
12
+
13
+ def to_xml
14
+ xml.d :propertyupdate, SB_NAMESPACES do
15
+ xml.d :set do
16
+ xml.d :prop do
17
+ xml.tag! "sb:email-address", email unless email.empty?
18
+ xml.d :displayname, displayname unless displayname.empty?
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,22 +1,22 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
- class ReportEventChanges < Base
4
- attr_accessor :sync_token
5
-
6
- def initialize(sync_token)
7
- @sync_token = sync_token
8
- super()
9
- end
10
-
11
- def to_xml
12
- xml.tag! "d:sync-collection", NAMESPACE do
13
- xml.tag! "d:sync-token", sync_token
14
- xml.tag! "d:sync-level", "1"
15
- xml.d :prop do
16
- xml.d :getetag
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+ class ReportEventChanges < Base
4
+ attr_accessor :sync_token
5
+
6
+ def initialize(sync_token)
7
+ @sync_token = sync_token
8
+ super()
9
+ end
10
+
11
+ def to_xml
12
+ xml.tag! "d:sync-collection", NAMESPACE do
13
+ xml.tag! "d:sync-token", sync_token
14
+ xml.tag! "d:sync-level", "1"
15
+ xml.d :prop do
16
+ xml.d :getetag
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,30 +1,30 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class ReportVEVENT < Base
5
- attr_accessor :tstart, :tend
6
-
7
- def initialize( tstart=nil, tend=nil )
8
- @tstart = tstart
9
- @tend = tend
10
- super()
11
- end
12
-
13
- def to_xml
14
- xml.c 'calendar-query'.intern, C_NAMESPACES do
15
- xml.d :prop do
16
- xml.d :getetag
17
- xml.c 'calendar-data'.intern
18
- end
19
- xml.c :filter do
20
- xml.c 'comp-filter'.intern, :name=> 'VCALENDAR' do
21
- xml.c 'comp-filter'.intern, :name=> 'VEVENT' do
22
- xml.c 'time-range'.intern, :start=> "#{tstart}Z", :end=> "#{tend}Z"
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class ReportVEVENT < Base
5
+ attr_accessor :tstart, :tend
6
+
7
+ def initialize( tstart=nil, tend=nil )
8
+ @tstart = tstart
9
+ @tend = tend
10
+ super()
11
+ end
12
+
13
+ def to_xml
14
+ xml.c 'calendar-query'.intern, C_NAMESPACES do
15
+ xml.d :prop do
16
+ xml.d :getetag
17
+ xml.c 'calendar-data'.intern
18
+ end
19
+ xml.c :filter do
20
+ xml.c 'comp-filter'.intern, :name=> 'VCALENDAR' do
21
+ xml.c 'comp-filter'.intern, :name=> 'VEVENT' do
22
+ xml.c 'time-range'.intern, :start=> "#{tstart}Z", :end=> "#{tend}Z"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,20 +1,20 @@
1
- module SabredavClient
2
- module XmlRequestBuilder
3
-
4
- class ReportVTODO < Base
5
- def to_xml
6
- xml.c 'calendar-query'.intern, C_NAMESPACES do
7
- xml.d :prop do
8
- xml.d :getetag
9
- xml.c 'calendar-data'.intern
10
- end
11
- xml.c :filter do
12
- xml.c 'comp-filter'.intern, :name=> 'VCALENDAR' do
13
- xml.c 'comp-filter'.intern, :name=> 'VTODO'
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
1
+ module SabredavClient
2
+ module XmlRequestBuilder
3
+
4
+ class ReportVTODO < Base
5
+ def to_xml
6
+ xml.c 'calendar-query'.intern, C_NAMESPACES do
7
+ xml.d :prop do
8
+ xml.d :getetag
9
+ xml.c 'calendar-data'.intern
10
+ end
11
+ xml.c :filter do
12
+ xml.c 'comp-filter'.intern, :name=> 'VCALENDAR' do
13
+ xml.c 'comp-filter'.intern, :name=> 'VTODO'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,31 +1,31 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require File.expand_path('../lib/sabredav_client/version', __FILE__)
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "sabredav_client"
7
- s.version = SabredavClient::VERSION
8
- s.summary = "Ruby SabreDAV client"
9
- s.description = "A great Ruby client for SabreDAV Servers."
10
-
11
- s.required_ruby_version = '>= 1.9.2'
12
-
13
- s.license = 'MIT'
14
-
15
- s.homepage = %q{https://github.com/njiuko/sabredav_client}
16
- s.authors = [%q{Nicolas Schwartau}]
17
- s.email = [%q{n.schwartau@gmail.com}]
18
-
19
- s.add_runtime_dependency 'builder', '~> 3.2'
20
- s.add_runtime_dependency 'net-http-digest_auth', '~> 1.4'
21
-
22
- s.add_development_dependency 'rspec', '~> 3.5'
23
- s.add_development_dependency 'fakeweb', '~> 1.3'
24
-
25
- s.description = <<-DESC
26
- sabredav_client is a great Ruby client for SabreDAV servers. It is based on the agcaldav gem.
27
- DESC
28
-
29
- s.files = `git ls-files`.split("\n")
30
- s.require_paths = ["lib"]
31
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require File.expand_path('../lib/sabredav_client/version', __FILE__)
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sabredav_client"
7
+ s.version = SabredavClient::VERSION
8
+ s.summary = "Ruby SabreDAV client"
9
+ s.description = "A great Ruby client for SabreDAV Servers."
10
+
11
+ s.required_ruby_version = '>= 1.9.2'
12
+
13
+ s.license = 'MIT'
14
+
15
+ s.homepage = %q{https://github.com/njiuko/sabredav_client}
16
+ s.authors = [%q{Nicolas Schwartau}]
17
+ s.email = [%q{n.schwartau@gmail.com}]
18
+
19
+ s.add_runtime_dependency 'builder', '~> 3.2'
20
+ s.add_runtime_dependency 'net-http-digest_auth', '~> 1.4'
21
+
22
+ s.add_development_dependency 'rspec', '~> 3.5'
23
+ s.add_development_dependency 'fakeweb', '~> 1.3'
24
+
25
+ s.description = <<-DESC
26
+ sabredav_client is a great Ruby client for SabreDAV servers. It is based on the agcaldav gem.
27
+ DESC
28
+
29
+ s.files = `git ls-files`.split("\n")
30
+ s.require_paths = ["lib"]
31
+ end
@@ -1,26 +1,26 @@
1
- <?xml version="1.0" encoding="utf-8" ?>
2
- <d:multistatus xmlns:d="DAV:">
3
- <d:response>
4
- <d:href>/calendars/johndoe/home/newevent.ics</d:href>
5
- <d:propstat>
6
- <d:prop>
7
- <d:getetag>"1"</d:getetag>
8
- </d:prop>
9
- <d:status>HTTP/1.1 200 OK</d:status>
10
- </d:propstat>
11
- </d:response>
12
- <d:response>
13
- <d:href>/calendars/johndoe/home/updatedevent.ics</d:href>
14
- <d:propstat>
15
- <d:prop>
16
- <d:getetag>"2"</d:getetag>
17
- </d:prop>
18
- <d:status>HTTP/1.1 200 OK</d:status>
19
- </d:propstat>
20
- </d:response>
21
- <d:response>
22
- <d:href>/calendars/johndoe/home/deletedevent.ics</d:href>
23
- <d:status>HTTP/1.1 404 Not Found</d:status>
24
- </d:response>
25
- <d:sync-token>http://sabredav.org/ns/sync/5001</d:sync-token>
26
- </d:multistatus>
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <d:multistatus xmlns:d="DAV:">
3
+ <d:response>
4
+ <d:href>/calendars/johndoe/home/newevent.ics</d:href>
5
+ <d:propstat>
6
+ <d:prop>
7
+ <d:getetag>"1"</d:getetag>
8
+ </d:prop>
9
+ <d:status>HTTP/1.1 200 OK</d:status>
10
+ </d:propstat>
11
+ </d:response>
12
+ <d:response>
13
+ <d:href>/calendars/johndoe/home/updatedevent.ics</d:href>
14
+ <d:propstat>
15
+ <d:prop>
16
+ <d:getetag>"2"</d:getetag>
17
+ </d:prop>
18
+ <d:status>HTTP/1.1 200 OK</d:status>
19
+ </d:propstat>
20
+ </d:response>
21
+ <d:response>
22
+ <d:href>/calendars/johndoe/home/deletedevent.ics</d:href>
23
+ <d:status>HTTP/1.1 404 Not Found</d:status>
24
+ </d:response>
25
+ <d:sync-token>http://sabredav.org/ns/sync/5001</d:sync-token>
26
+ </d:multistatus>