sabredav_client 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
  SHA1:
3
- metadata.gz: 5a3c684d5190fe9608d786b4619fc6494ead48b7
4
- data.tar.gz: b44836242e58f0ed59c074f71b76b1ac1f145fa2
3
+ metadata.gz: ae2d27dea599feaf7acbd21fbd193654db5cde99
4
+ data.tar.gz: 0f9c24649a0c48f8ff7a7f3df0f0b9199db308d2
5
5
  SHA512:
6
- metadata.gz: 31bb29f8199f0a2e1fc1c3fc46120951aa79131d631637eedcf3e5d61acf463418f39684a24341a24cecb9050e6b7bdfd0a1f744aa89c07f193e05fc91ecc955
7
- data.tar.gz: 2ac0d0920b6ae3500f8cef24e6396756fba06bcafda200bafe0e0cf3509ff27839528f75af580fd0c716dc4640da226143bfb88f4886bf751de27dd9601d1b00
6
+ metadata.gz: 464a6433ebe8a79b9de028c06abe82baabad0fc2c0b2eb1680eb6d05e5b65bcd211c5f013b7de0eba8012c3046b9d439385cad216feca482e0fa3a1a95e5fd6f
7
+ data.tar.gz: 326bc569d1fc23fb613d78137d22fa85746197e6c89494b228dc3b73a815b212457ac914ef35c25e22836471951e4f66f3f48c118c53cce865b63229cdcc3d71
data/Gemfile.lock CHANGED
@@ -1,11 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sabredav_client (0.2.6.0)
4
+ sabredav_client (0.1.0)
5
5
  builder (~> 3.2)
6
- icalendar (~> 2.4)
7
6
  net-http-digest_auth (~> 1.4)
8
- uuid (~> 2.3)
9
7
 
10
8
  GEM
11
9
  remote: https://rubygems.org/
@@ -13,9 +11,6 @@ GEM
13
11
  builder (3.2.2)
14
12
  diff-lcs (1.2.5)
15
13
  fakeweb (1.3.0)
16
- icalendar (2.4.0)
17
- macaddr (1.7.1)
18
- systemu (~> 2.6.2)
19
14
  net-http-digest_auth (1.4)
20
15
  rspec (3.5.0)
21
16
  rspec-core (~> 3.5.0)
@@ -30,9 +25,6 @@ GEM
30
25
  diff-lcs (>= 1.2.0, < 2.0)
31
26
  rspec-support (~> 3.5.0)
32
27
  rspec-support (3.5.0)
33
- systemu (2.6.5)
34
- uuid (2.3.8)
35
- macaddr (~> 1.0)
36
28
 
37
29
  PLATFORMS
38
30
  ruby
data/README.md CHANGED
@@ -1,113 +1,35 @@
1
- #Ruby CalDAV library named "agcaldav"
2
- **agcaldav is a CalDAV library based on martinpovolny/ruby-caldav and 4fthawaiian/ruby-caldav and collectiveidea/caldav**
1
+ #Ruby CalDAV library named "sabredav_client"
2
+ **sabredav_client is a CalDAV library based on martinpovolny/ruby-caldav and 4fthawaiian/ruby-caldav and collectiveidea/caldav**"
3
3
 
4
- **Please keep in mind, agcaldav ist still under heavy development and still not finished...**
4
+ **Please keep in mind, sabredav_client ist still under heavy development and still not finished...**
5
5
 
6
6
  ##Usage Events
7
7
 
8
8
  First, you've to install the gem
9
9
 
10
- gem install agcaldav
10
+ gem install sabredav_client
11
11
 
12
12
  and require it
13
13
 
14
- require "agcaldav"
15
-
16
- Next you have to obtain the URI, username and password to a CalDAV-Server. If you don't have one try RADICALE (https://github.com/agilastic/Radicale). It's small, simple and written in python. In the following steps I'm using the default params of Radical.
17
-
18
-
19
- Now you can e.g. create a new AgCalDAV-Client:
20
-
21
- cal = AgCalDAV::Client.new(:uri => "http://localhost:5232/user/calendar", :user => "user" , :password => "")
22
-
23
- Alternatively, the proxy parameters can be specified:
24
-
25
- cal = AgCalDAV::Client.new(:uri => "http://localhost:5232/user/calendar",:user => "user" , :password => "password", :proxy_uri => "http://my-proxy.com:8080")
26
-
14
+ require "sabredav_client"
27
15
 
28
16
  ####Create an Event
29
17
 
30
- result = cal.create_event(:start => "2012-12-29 10:00", :end => "2012-12-30 12:00", :title => "12345", :description => "12345 12345")
31
-
32
- Analyze result:
33
-
34
- >> result
35
- => #<Icalendar::Event:0x007ff653b47520 @name="VEVENT", @components={}, @properties={"sequence"=>0, "dtstamp"=>#<DateTime: 2012-12-30T19:59:04+00:00 (26527957193/10800,0/1,2299161)>, "description"=>"sdkvjsdf sdkf sdkfj sdkf dsfj", "dtend"=>#<DateTime: 2012-12-30T12:00:00+00:00 (2456292/1,0/1,2299161)>, "dtstart"=>#<DateTime: 2012-12-29T10:00:00+00:00 (29475491/12,0/1,2299161)>, "summary"=>"12345", "uid"=>"e795c480-34e0-0130-7d1d-109add70606c", "x-radicale_name"=>"e795c480-34e0-0130-7d1d-109add70606c.ics"}>
36
-
37
- >> result.class
38
- => Icalendar::Event
39
-
40
-
41
- get UID of this Event:
42
-
43
- >> result.uid
44
- => "e795c480-34e0-0130-7d1d-109add70606c"
45
-
46
-
47
18
  ####Find an Event (via UUID)
48
19
 
49
- result = cal.find_event("e795c480-34e0-0130-7d1d-109add70606c")
50
-
51
- >> result.class
52
- => Icalendar::Event
53
-
54
-
55
20
  ####Find Events within time interval
56
21
 
57
- result = cal.find_events(:start => "2012-10-01 08:00", :end => "2013-01-01")
58
-
59
- >> result
60
- => [#<Icalendar::Event:0x007f8ad11cfdf0 @name="VEVENT", @components={}, @properties={"sequence"=>0, "dtstamp"=>#<DateTime: 2012-12-31T13:44:10+00:00 (4244474429/1728,0/1,2299161)>, "description"=>"sdkvjsdf sdkf sdkfj sdkf dsfj", "dtend"=>#<DateTime: 2012-12-30T12:00:00+00:00 (2456292/1,0/1,2299161)>, "dtstart"=>#<DateTime: 2012-12-29T10:00:00+00:00 (29475491/12,0/1,2299161)>, "summary"=>"12345", "uid"=>"b2c45e20-3575-0130-7d2e-109add70606c", "x-radicale_name"=>"b2c45e20-3575-0130-7d2e-109add70606c.ics"}>, #<Icalendar::Event:0x007f8ad10d7dd0 @name="VEVENT", @components={}, @properties={"sequence"=>0, "dtstamp"=>#<DateTime: 2012-12-31T13:44:10+00:00 (4244474429/1728,0/1,2299161)>, "uid"=>"b2c45e20-3575-0130-7d2e-109add70606c", "x-radicale_name"=>"b2c45e20-3575-0130-7d2e-109add70606c.ics"}>]
61
-
62
- >> result.class
63
- => Array
64
-
65
- >> result.count
66
- => 2
67
-
68
-
69
-
70
22
  ####Update Event
71
23
 
72
- event = {:start => "2012-12-29 10:00", :end => "2012-12-30 12:00", :title => "12345", :description => "sdkvjsdf sdkf sdkfj sdkf dsfj"}
73
- # set UUID
74
- event[:uid] => "e795c480-34e0-0130-7d1d-109add70606c"
75
- c = cal.update_event(event)
76
-
77
-
78
-
79
24
  ####Delete Event
80
25
 
81
- cal.delete_event("e795c480-34e0-0130-7d1d-109add70606c")
82
-
83
-
84
-
85
-
86
26
  ##Usage ToDo
87
27
 
88
- ####not finished ATM
89
- Have a look tomorrow...
90
-
91
-
92
-
93
- ##Work to be done ...
94
-
95
- 1. find and notify if overlapping events
96
- 2. code cleanup -> more ActiveRecord style
97
-
98
-
99
-
100
-
101
28
  ##Testing
102
29
 
103
- agcaldav will use RSpec for its test coverage. Inside the gem
30
+ sabredav_client will use RSpec for its test coverage. Inside the gem
104
31
  directory, you can run the specs for RoR 3.x with:
105
32
 
106
- rake spec
107
- (will be implemented in > v0.2.5)
108
-
109
-
110
-
111
33
  ##Licence
112
34
 
113
35
  MIT
@@ -116,16 +38,12 @@ MIT
116
38
 
117
39
  ##Contributors
118
40
 
119
- [Check all contributors][c]
120
41
 
121
42
 
122
43
  1. Fork it.
123
44
  2. Create a branch (`git checkout -b my_feature_branch`)
124
45
  3. Commit your changes (`git commit -am "bugfixed abc..."`)
125
46
  4. Push to the branch (`git push origin my_feature_branch`)
126
- 5. Open a [Pull Request][1]
47
+ 5. Open a Pull Request
127
48
  6. Enjoy a refreshing Club Mate and wait
128
49
 
129
- [c]: https://github.com/agilastic/agcaldav/contributors
130
- [1]: https://github.com/agilastic/agcaldav/pulls/
131
-
@@ -36,12 +36,7 @@ module SabredavClient
36
36
  xml = REXML::Document.new(res.body)
37
37
  REXML::XPath.each( xml, '//c:calendar-data/', {"c"=>"urn:ietf:params:xml:ns:caldav"} ){|c| result << c.text}
38
38
 
39
- calendar = Icalendar::Calendar.parse(result).first
40
- if calendar
41
- calendar.events
42
- else
43
- false
44
- end
39
+ result
45
40
  end
46
41
 
47
42
  def owner(uri)
@@ -1,3 +1,3 @@
1
1
  module SabredavClient
2
- VERSION="0.1.0"
2
+ VERSION="0.1.1"
3
3
  end
@@ -1,12 +1,10 @@
1
1
  require 'net/https'
2
2
  require 'net/http/digest_auth'
3
- require 'uuid'
4
3
  require 'rexml/document'
5
4
  require 'rexml/xpath'
6
- require 'icalendar'
7
5
  require 'time'
8
6
  require 'date'
9
7
 
10
- ['errors/errors.rb','xml_request_builder.rb', 'client.rb', 'request.rb', 'net.rb', 'format.rb', "calendar.rb", "events.rb", "principal.rb"].each do |f|
8
+ ['errors/errors.rb','xml_request_builder.rb', 'client.rb', 'request.rb', 'net.rb', "calendar.rb", "events.rb", "principal.rb"].each do |f|
11
9
  require File.join( File.dirname(__FILE__), 'sabredav_client', f )
12
10
  end
@@ -16,8 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.authors = [%q{Nicolas Schwartau}]
17
17
  s.email = [%q{n.schwartau@gmail.com}]
18
18
 
19
- s.add_runtime_dependency 'icalendar', '~> 2.4'
20
- s.add_runtime_dependency 'uuid', '~> 2.3'
21
19
  s.add_runtime_dependency 'builder', '~> 3.2'
22
20
  s.add_runtime_dependency 'net-http-digest_auth', '~> 1.4'
23
21
 
@@ -43,8 +43,10 @@ describe SabredavClient::Events do
43
43
  FakeWeb.register_uri(:report, "http://user@localhost:5232/user/calendar/", body: File.open('spec/fixtures/events_find_multiple.xml'))
44
44
  r = events.find_multiple(starts: "2001-02-02 07:00", ends: "2000-02-03 23:59")
45
45
 
46
- expect(r.first).to be_a(Icalendar::Event)
47
- expect(r.length).to eq 2
46
+ expect(r).to include("BEGIN:VCALENDAR")
47
+ expect(r).to include("UID:960232b0-371c-0130-9e6b-001999638982")
48
+ expect(r).to include("UID:98f067a0-371c-0130-9e6c-001999638982")
49
+ expect(r).to include("END:VCALENDAR")
48
50
  end
49
51
  end
50
52
 
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sabredav_client
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
  - Nicolas Schwartau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: icalendar
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.4'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.4'
27
- - !ruby/object:Gem::Dependency
28
- name: uuid
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.3'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.3'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: builder
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +86,6 @@ files:
114
86
  - lib/sabredav_client/client.rb
115
87
  - lib/sabredav_client/errors/errors.rb
116
88
  - lib/sabredav_client/events.rb
117
- - lib/sabredav_client/format.rb
118
89
  - lib/sabredav_client/net.rb
119
90
  - lib/sabredav_client/principal.rb
120
91
  - lib/sabredav_client/request.rb
@@ -1,54 +0,0 @@
1
- module SabredavClient
2
- module Format
3
- class Raw
4
- def method_missing(m, *args, &block)
5
- return *args
6
- end
7
- end
8
-
9
- class Debug < Raw
10
- end
11
-
12
- class Pretty < Raw
13
- def parse_calendar(s)
14
- result = ""
15
- xml = REXML::Document.new(s)
16
-
17
- REXML::XPath.each( xml, '//c:calendar-data/', {"c"=>"urn:ietf:params:xml:ns:caldav"} ){|c| result << c.text}
18
- r = Icalendar.parse(result)
19
- r
20
- end
21
-
22
- def parse_todo( body )
23
- result = []
24
- xml = REXML::Document.new( body )
25
- REXML::XPath.each( xml, '//c:calendar-data/', { "c"=>"urn:ietf:params:xml:ns:caldav"} ){ |c|
26
- p c.text
27
- p parse_tasks( c.text )
28
- result += parse_tasks( c.text )
29
- }
30
- return result
31
- end
32
-
33
- def parse_tasks( vcal )
34
- return_tasks = Array.new
35
- cals = Icalendar.parse(vcal)
36
- cals.each { |tcal|
37
- tcal.todos.each { |ttask| # FIXME
38
- return_tasks << ttask
39
- }
40
- }
41
- return return_tasks
42
- end
43
-
44
- def parse_events( vcal )
45
- Icalendar.parse(vcal)
46
- end
47
-
48
- def parse_single( body )
49
- # FIXME: parse event/todo/vcard
50
- parse_events( body )
51
- end
52
- end
53
- end
54
- end