gcal4ruby 0.1.0
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.
- data/README +83 -0
- data/lib/gcal4ruby/base.rb +256 -0
- data/lib/gcal4ruby/calendar.rb +297 -0
- data/lib/gcal4ruby/event.rb +403 -0
- data/lib/gcal4ruby/recurrence.rb +164 -0
- data/lib/gcal4ruby/service.rb +61 -0
- data/lib/gcal4ruby.rb +1 -0
- data/test/unit.rb +120 -0
- metadata +59 -0
data/test/unit.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'gcal4ruby'
|
5
|
+
include GCal4Ruby
|
6
|
+
|
7
|
+
@service = Service.new
|
8
|
+
@username = nil
|
9
|
+
@password = nil
|
10
|
+
|
11
|
+
def tester
|
12
|
+
if ARGV.include?("-d")
|
13
|
+
@service.debug = true
|
14
|
+
end
|
15
|
+
ARGV.each do |ar|
|
16
|
+
if ar.match("username=")
|
17
|
+
@username = ar.gsub("username=", "")
|
18
|
+
end
|
19
|
+
if ar.match("password=")
|
20
|
+
@password = ar.gsub("password=", "")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
service_test
|
24
|
+
calendar_test
|
25
|
+
event_test
|
26
|
+
end
|
27
|
+
|
28
|
+
def service_test
|
29
|
+
puts "---Starting Service Test---"
|
30
|
+
puts "1. Authenticate"
|
31
|
+
if @service.authenticate(@username, @password)
|
32
|
+
successful
|
33
|
+
else
|
34
|
+
failed
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "2. Calendar List"
|
38
|
+
cals = @service.calendars
|
39
|
+
if cals
|
40
|
+
successful "Calendars for this Account:"
|
41
|
+
cals.each do |cal|
|
42
|
+
puts cal.title
|
43
|
+
end
|
44
|
+
else
|
45
|
+
failed
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def calendar_test
|
50
|
+
puts "---Starting Calendar Test---"
|
51
|
+
|
52
|
+
puts "1. Create Calendar"
|
53
|
+
cal = Calendar.new(@service)
|
54
|
+
cal.title = "test calendar"+Time.now.to_s
|
55
|
+
puts "Calender exists = "+cal.exists?.to_s
|
56
|
+
if cal.save
|
57
|
+
successful cal.to_xml
|
58
|
+
else
|
59
|
+
failed
|
60
|
+
end
|
61
|
+
|
62
|
+
puts "2. Edit Calendar"
|
63
|
+
cal.title = "renamed title"
|
64
|
+
if cal.save
|
65
|
+
successful cal.to_xml
|
66
|
+
else
|
67
|
+
puts "Test 2 Failed"
|
68
|
+
end
|
69
|
+
|
70
|
+
puts "3. Delete Calendar"
|
71
|
+
if cal.delete and not cal.title
|
72
|
+
successful
|
73
|
+
else
|
74
|
+
failed
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def event_test
|
79
|
+
puts "---Starting Event Test---"
|
80
|
+
|
81
|
+
puts "1. Create Event"
|
82
|
+
event = Event.new(@service.calendars[0])
|
83
|
+
event.title = "Test Event"
|
84
|
+
event.content = "Test event content"
|
85
|
+
event.start = Time.now+1800
|
86
|
+
event.end = Time.now+5400
|
87
|
+
if event.save
|
88
|
+
successful event.to_xml
|
89
|
+
else
|
90
|
+
failed
|
91
|
+
end
|
92
|
+
|
93
|
+
puts "2. Edit Event"
|
94
|
+
event.title = "Edited title"
|
95
|
+
if event.save
|
96
|
+
successful event.to_xml
|
97
|
+
else
|
98
|
+
failed
|
99
|
+
end
|
100
|
+
|
101
|
+
puts "3. Delete Event"
|
102
|
+
if event.delete
|
103
|
+
successful
|
104
|
+
else
|
105
|
+
failed
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def failed(m = nil)
|
110
|
+
puts "Test Failed"
|
111
|
+
puts m if m
|
112
|
+
exit()
|
113
|
+
end
|
114
|
+
|
115
|
+
def successful(m = nil)
|
116
|
+
puts "Test Successful"
|
117
|
+
puts m if m
|
118
|
+
end
|
119
|
+
|
120
|
+
tester
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gcal4ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Reich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-02 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A full featured wrapper for interacting with the Google Calendar API
|
17
|
+
email: mike@seabourneconsulting.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- README
|
26
|
+
- lib/gcal4ruby.rb
|
27
|
+
- lib/gcal4ruby/base.rb
|
28
|
+
- lib/gcal4ruby/service.rb
|
29
|
+
- lib/gcal4ruby/calendar.rb
|
30
|
+
- lib/gcal4ruby/event.rb
|
31
|
+
- lib/gcal4ruby/recurrence.rb
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://gcal4ruby.rubyforge.org/
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
requirements: []
|
52
|
+
|
53
|
+
rubyforge_project: gcal4ruby
|
54
|
+
rubygems_version: 1.3.1
|
55
|
+
signing_key:
|
56
|
+
specification_version: 2
|
57
|
+
summary: A full featured wrapper for interacting with the Google Calendar API
|
58
|
+
test_files:
|
59
|
+
- test/unit.rb
|