agcaldav 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  #Ruby CalDAV library named "agcaldav"
2
2
  **agcaldav 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...**
5
+
4
6
  ##Usage Events
5
7
 
6
8
  First, you've to install the gem
@@ -35,9 +37,6 @@ Analyze result:
35
37
  >> result.class
36
38
  => Icalendar::Event
37
39
 
38
- >> result.count
39
- => 1
40
-
41
40
 
42
41
  get UID of this Event:
43
42
 
@@ -91,7 +90,7 @@ Have a look tomorrow...
91
90
 
92
91
 
93
92
 
94
- ####Work to be done ...
93
+ ##Work to be done ...
95
94
 
96
95
  1. find and notify if overlapping events
97
96
  2. code cleanup -> more ActiveRecord style
@@ -99,7 +98,7 @@ Have a look tomorrow...
99
98
 
100
99
 
101
100
 
102
- ####Testing
101
+ ##Testing
103
102
 
104
103
  agcaldav will use RSpec for its test coverage. Inside the gem
105
104
  directory, you can run the specs for RoR 3.x with:
@@ -109,21 +108,17 @@ directory, you can run the specs for RoR 3.x with:
109
108
 
110
109
 
111
110
 
112
- ####Licence
111
+ ##Licence
113
112
 
114
113
  MIT
115
114
 
116
115
 
117
116
 
118
- ####Contributors
117
+ ##Contributors
119
118
 
120
119
  [Check all contributors][c]
121
120
 
122
121
 
123
-
124
- Contributing
125
- ------------
126
-
127
122
  1. Fork it.
128
123
  2. Create a branch (`git checkout -b my_feature_branch`)
129
124
  3. Commit your changes (`git commit -am "bugfixed abc..."`)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new('spec')
4
+
5
+ # If you want to make this the default task
6
+ task :default => :spec
data/agcaldav.gemspec CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.add_runtime_dependency 'uuid'
23
23
  s.add_runtime_dependency 'builder'
24
24
  s.add_development_dependency "rspec"
25
+ s.add_development_dependency "webmock"
26
+
25
27
 
26
28
  s.files = `git ls-files`.split("\n")
27
29
  s.require_paths = ["lib"]
@@ -53,8 +53,13 @@ module AgCalDAV
53
53
  result = ""
54
54
  xml = REXML::Document.new(res.body)
55
55
  REXML::XPath.each( xml, '//c:calendar-data/', {"c"=>"urn:ietf:params:xml:ns:caldav"} ){|c| result << c.text}
56
- r = Icalendar.parse(result)
57
- r.first.events
56
+ r = Icalendar.parse(result)
57
+ unless r.empty?
58
+ # r.first.events.delete_at 0
59
+ r.first.events
60
+ else
61
+ return false
62
+ end
58
63
  end
59
64
 
60
65
  def find_event uuid
@@ -66,7 +71,13 @@ module AgCalDAV
66
71
  }
67
72
  errorhandling res
68
73
  r = Icalendar.parse(res.body)
69
- r.first.events.first
74
+ unless r.empty?
75
+ r.first.events.first
76
+ else
77
+ return false
78
+ end
79
+
80
+
70
81
  end
71
82
 
72
83
  def delete_event uuid
@@ -86,12 +97,16 @@ module AgCalDAV
86
97
 
87
98
  def create_event event
88
99
  c = Calendar.new
100
+ c.events = []
89
101
  uuid = UUID.new.generate
90
102
  raise DuplicateError if entry_with_uuid_exists?(uuid)
91
103
  c.event do
92
104
  uid uuid
93
105
  dtstart DateTime.parse(event[:start])
94
106
  dtend DateTime.parse(event[:end])
107
+ categories event[:categories]# Array
108
+ contacts event[:contacts] # Array
109
+ attendees event[:attendees]# Array
95
110
  duration event[:duration]
96
111
  summary event[:title]
97
112
  description event[:description]
@@ -100,7 +115,6 @@ module AgCalDAV
100
115
  geo_location event[:geo_location]
101
116
  status event[:status]
102
117
  end
103
- c.event.uid = uuid
104
118
  cstring = c.to_ical
105
119
  res = nil
106
120
  http = Net::HTTP.new(@host, @port)
@@ -1,3 +1,3 @@
1
1
  module AgCalDAV
2
- VERSION="0.2.3"
2
+ VERSION="0.2.4"
3
3
  end
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+ require 'spec_helper'
3
+ require 'fakeweb'
4
+
5
+ require 'agcaldav'
6
+
7
+ describe AgCalDAV::Client do
8
+
9
+ before(:each) do
10
+ @c = AgCalDAV::Client.new(:uri => "http://localhost:5232/user/calendar", :user => "user" , :password => "")
11
+ end
12
+
13
+ it "check Class of new calendar" do
14
+ @c.class.to_s.should == "AgCalDAV::Client"
15
+ end
16
+
17
+ it "find one event" do
18
+ FakeWeb.register_uri(:any, "http://localhost:5232/user/calendar/3bb14b40-3654-0130-7d41-109add70606c.ics", :body => "BEGIN:VCALENDAR\nPRODID:-//Radicale//NONSGML Radicale Server//EN\nVERSION:2.0\nBEGIN:VEVENT\nDESCRIPTION:12345 12ss345\nDTEND:20130101T110000\nDTSTAMP:20130101T161708\nDTSTART:20130101T100000\nSEQUENCE:0\nSUMMARY:123ss45\nUID:3bb14b40-3654-0130-7d41-109add70606c\nX-RADICALE-NAME:3bb14b40-3654-0130-7d41-109add70606c.ics\nEND:VEVENT\nEND:VCALENDAR")
19
+ # r = @c.find_event("85fcbaa0-364f-0130-7d3e-109add70606c")
20
+ # r.should_not be_nil
21
+ # r.length.should == 1
22
+ end
23
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,5 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'rubygems'
3
+ require 'agcaldav'
4
+
5
+ RSpec.configure do |config|
6
+ # some (optional) config here
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agcaldav
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-31 00:00:00.000000000 Z
12
+ date: 2013-01-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: icalendar
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: webmock
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
78
94
  description: yet another great Ruby client for CalDAV calendar and tasks.
79
95
  email: ebeling-hoppe@agilastic.de
80
96
  executables: []
@@ -82,7 +98,9 @@ extensions: []
82
98
  extra_rdoc_files: []
83
99
  files:
84
100
  - .gitignore
101
+ - .rspec
85
102
  - README.md
103
+ - Rakefile
86
104
  - agcaldav.gemspec
87
105
  - lib/agcaldav.rb
88
106
  - lib/agcaldav/client.rb
@@ -94,6 +112,9 @@ files:
94
112
  - lib/agcaldav/request.rb
95
113
  - lib/agcaldav/todo.rb
96
114
  - lib/agcaldav/version.rb
115
+ - spec/agcaldav/client_spec.rb
116
+ - spec/spec.opts
117
+ - spec/spec_helper.rb
97
118
  homepage: https://github.com/agilastic/agcaldav
98
119
  licenses:
99
120
  - MIT