gcalapi 0.1.1 → 0.1.2
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/Rakefile +1 -1
- data/VERSION +1 -1
- data/html/classes/GoogleCalendar.html +149 -149
- data/html/classes/GoogleCalendar/AuthSubFailed.html +162 -162
- data/html/classes/GoogleCalendar/AuthSubUtil.html +352 -352
- data/html/classes/GoogleCalendar/AuthenticationFailed.html +110 -110
- data/html/classes/GoogleCalendar/Calendar.html +381 -381
- data/html/classes/GoogleCalendar/Event.html +699 -699
- data/html/classes/GoogleCalendar/EventDeleteFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventGetFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventInsertFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventUpdateFailed.html +110 -110
- data/html/classes/GoogleCalendar/InvalidCalendarURL.html +110 -110
- data/html/classes/GoogleCalendar/Service.html +245 -305
- data/html/classes/GoogleCalendar/ServiceAuthSub.html +176 -176
- data/html/classes/GoogleCalendar/ServiceBase.html +752 -693
- data/html/created.rid +1 -1
- data/html/files/README.html +117 -117
- data/html/files/lib/googlecalendar/auth_sub_util_rb.html +110 -110
- data/html/files/lib/googlecalendar/calendar_rb.html +109 -109
- data/html/files/lib/googlecalendar/event_rb.html +109 -109
- data/html/files/lib/googlecalendar/service_auth_sub_rb.html +107 -107
- data/html/files/lib/googlecalendar/service_base_rb.html +113 -113
- data/html/files/lib/googlecalendar/service_rb.html +107 -107
- data/html/fr_class_index.html +39 -39
- data/html/fr_file_index.html +32 -32
- data/html/fr_method_index.html +75 -75
- data/html/index.html +23 -23
- data/html/rdoc-style.css +207 -207
- data/lib/googlecalendar/service.rb +1 -18
- data/lib/googlecalendar/service_base.rb +17 -0
- data/test/03_authsub_test.rb +14 -2
- data/test/all.bat +1 -0
- data/test/all.sh +0 -0
- data/test/each.sh +0 -0
- metadata +47 -70
- data/VERSION.BAK +0 -1
@@ -11,23 +11,6 @@ module GoogleCalendar
|
|
11
11
|
# Server Path to authenticate
|
12
12
|
AUTH_PATH = "/accounts/ClientLogin"
|
13
13
|
|
14
|
-
# URL to get calendar list
|
15
|
-
CALENDAR_LIST_PATH = "http://www.google.com/calendar/feeds/"
|
16
|
-
|
17
|
-
#
|
18
|
-
# get the list of user's calendars and returns http response object
|
19
|
-
#
|
20
|
-
def calendar_list
|
21
|
-
logger.info("-- calendar list st --") if logger
|
22
|
-
auth unless @auth
|
23
|
-
uri = URI.parse(CALENDAR_LIST_PATH + @email)
|
24
|
-
res = do_get(uri, {})
|
25
|
-
logger.info("-- calendar list en(#{res.message}) --") if logger
|
26
|
-
res
|
27
|
-
end
|
28
|
-
|
29
|
-
alias :calendars :calendar_list
|
30
|
-
|
31
14
|
def initialize(email, pass)
|
32
15
|
@email = email
|
33
16
|
@pass = pass
|
@@ -44,7 +27,7 @@ module GoogleCalendar
|
|
44
27
|
head = {'Content-Type' => 'application/x-www-form-urlencoded'}
|
45
28
|
logger.info "-- auth st --" if logger
|
46
29
|
https.start do |w|
|
47
|
-
res = w.post(AUTH_PATH, "Email=#{@email}&Passwd=#{@pass}&source=company-app-1&service=cl", head)
|
30
|
+
res = w.post(AUTH_PATH, "Email=#{@email}&Passwd=#{CGI.escape(@pass)}&source=company-app-1&service=cl", head)
|
48
31
|
logger.debug res if logger
|
49
32
|
if res.body =~ /Auth=(.+)/
|
50
33
|
@auth = $1
|
@@ -19,6 +19,9 @@ module GoogleCalendar
|
|
19
19
|
# Server name to Authenticate
|
20
20
|
AUTH_SERVER = "www.google.com"
|
21
21
|
|
22
|
+
# URL to get calendar list
|
23
|
+
CALENDAR_LIST_PATH = "http://www.google.com/calendar/feeds/default/allcalendars/full"
|
24
|
+
|
22
25
|
# proxy server address
|
23
26
|
@@proxy_addr = nil
|
24
27
|
def self.proxy_addr
|
@@ -61,6 +64,20 @@ module GoogleCalendar
|
|
61
64
|
|
62
65
|
attr_accessor :logger
|
63
66
|
|
67
|
+
#
|
68
|
+
# get the list of user's calendars and returns http response object
|
69
|
+
#
|
70
|
+
def calendar_list
|
71
|
+
logger.info("-- calendar list st --") if logger
|
72
|
+
auth unless @auth
|
73
|
+
uri = URI.parse(CALENDAR_LIST_PATH)
|
74
|
+
res = do_get(uri, {})
|
75
|
+
logger.info("-- calendar list en(#{res.message}) --") if logger
|
76
|
+
res
|
77
|
+
end
|
78
|
+
|
79
|
+
alias :calendars :calendar_list
|
80
|
+
|
64
81
|
#
|
65
82
|
# send query for events of a calendar and returns http response object.
|
66
83
|
# available condtions are
|
data/test/03_authsub_test.rb
CHANGED
@@ -8,7 +8,7 @@ require "googlecalendar/service_auth_sub"
|
|
8
8
|
require "googlecalendar/auth_sub_util"
|
9
9
|
|
10
10
|
class TestService3 < Test::Unit::TestCase
|
11
|
-
SAMPLE_URL = "http://
|
11
|
+
SAMPLE_URL = "http://zoriolab.info/test.html"
|
12
12
|
attr_accessor :logger
|
13
13
|
# get one-time token
|
14
14
|
def test_get_onetime_token(use_session = false)
|
@@ -100,11 +100,12 @@ class TestService3 < Test::Unit::TestCase
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_session_info
|
103
|
+
uri = URI.parse(SAMPLE_URL)
|
103
104
|
test_use_session_token do |token, session|
|
104
105
|
ret = GoogleCalendar::AuthSubUtil.token_info(token)
|
105
106
|
expected = {"Secure" => "false",
|
106
107
|
"Scope" => GoogleCalendar::AuthSubUtil::CALENDAR_SCOPE,
|
107
|
-
"Target" =>
|
108
|
+
"Target" => uri.host}
|
108
109
|
expected.each do |k,v|
|
109
110
|
assert(ret.key?(k))
|
110
111
|
assert_equal(v, ret[k]) if ret.key?(k)
|
@@ -112,6 +113,17 @@ class TestService3 < Test::Unit::TestCase
|
|
112
113
|
end
|
113
114
|
end
|
114
115
|
|
116
|
+
def test_calendar_list
|
117
|
+
test_use_session_token do |token, srv|
|
118
|
+
ret = srv.calendar_list
|
119
|
+
assert_equal("200", ret.code, ret.body)
|
120
|
+
xml = nil
|
121
|
+
assert_nothing_raised { xml = REXML::Document.new(ret.body) }
|
122
|
+
list = xml.root.elements.each("entry/link") {}.map {|e| e.attributes["href"] if e.attributes["rel"] == "alternate"}.compact
|
123
|
+
assert(list.include?(FEED.gsub(/@/,"%40")))
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
115
127
|
def test_ensure_revoked
|
116
128
|
10.times do |n|
|
117
129
|
test_use_session_token do |token, srv|
|
data/test/all.bat
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby -e "Dir.foreach('.') {|file| require file if file =~ /_test.rb$/}"
|
data/test/all.sh
CHANGED
File without changes
|
data/test/each.sh
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gcalapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zorio
|
@@ -9,7 +9,7 @@ autorequire: googlecalendar/calendar
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-11 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,88 +22,65 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README
|
24
24
|
files:
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
- doc/files/lib
|
46
|
-
- doc/files/lib/googlecalendar
|
47
|
-
- doc/files/test
|
48
|
-
- example
|
49
|
-
- example/mail2gcal.rb
|
50
|
-
- example/mixi2gcal.rb
|
51
|
-
- example/ol2gcal.rb
|
25
|
+
- lib
|
26
|
+
- lib/gcalapi.rb
|
27
|
+
- lib/googlecalendar
|
28
|
+
- lib/googlecalendar/event.rb
|
29
|
+
- lib/googlecalendar/service.rb
|
30
|
+
- lib/googlecalendar/auth_sub_util.rb
|
31
|
+
- lib/googlecalendar/service_auth_sub.rb
|
32
|
+
- lib/googlecalendar/calendar.rb
|
33
|
+
- lib/googlecalendar/service_base.rb
|
34
|
+
- test
|
35
|
+
- test/all.sh
|
36
|
+
- test/02_event_test.rb
|
37
|
+
- test/each.sh
|
38
|
+
- test/03_authsub_test.rb
|
39
|
+
- test/template.parameters.rb
|
40
|
+
- test/base_unit.rb
|
41
|
+
- test/all.bat
|
42
|
+
- test/00_service_test.rb
|
43
|
+
- test/01_calendar_test.rb
|
44
|
+
- VERSION
|
52
45
|
- html
|
53
46
|
- html/classes
|
47
|
+
- html/classes/GoogleCalendar.html
|
54
48
|
- html/classes/GoogleCalendar
|
55
|
-
- html/classes/GoogleCalendar/AuthenticationFailed.html
|
56
|
-
- html/classes/GoogleCalendar/AuthSubFailed.html
|
57
49
|
- html/classes/GoogleCalendar/AuthSubUtil.html
|
58
|
-
- html/classes/GoogleCalendar/
|
59
|
-
- html/classes/GoogleCalendar/Event.html
|
60
|
-
- html/classes/GoogleCalendar/EventDeleteFailed.html
|
50
|
+
- html/classes/GoogleCalendar/Service.html
|
61
51
|
- html/classes/GoogleCalendar/EventGetFailed.html
|
52
|
+
- html/classes/GoogleCalendar/EventDeleteFailed.html
|
62
53
|
- html/classes/GoogleCalendar/EventInsertFailed.html
|
63
|
-
- html/classes/GoogleCalendar/
|
54
|
+
- html/classes/GoogleCalendar/ServiceBase.html
|
64
55
|
- html/classes/GoogleCalendar/InvalidCalendarURL.html
|
65
|
-
- html/classes/GoogleCalendar/Service.html
|
66
56
|
- html/classes/GoogleCalendar/ServiceAuthSub.html
|
67
|
-
- html/classes/GoogleCalendar/
|
68
|
-
- html/classes/GoogleCalendar.html
|
69
|
-
- html/
|
57
|
+
- html/classes/GoogleCalendar/EventUpdateFailed.html
|
58
|
+
- html/classes/GoogleCalendar/AuthSubFailed.html
|
59
|
+
- html/classes/GoogleCalendar/AuthenticationFailed.html
|
60
|
+
- html/classes/GoogleCalendar/Calendar.html
|
61
|
+
- html/classes/GoogleCalendar/Event.html
|
70
62
|
- html/files
|
63
|
+
- html/files/README.html
|
71
64
|
- html/files/lib
|
72
65
|
- html/files/lib/googlecalendar
|
73
|
-
- html/files/lib/googlecalendar/auth_sub_util_rb.html
|
74
|
-
- html/files/lib/googlecalendar/calendar_rb.html
|
75
66
|
- html/files/lib/googlecalendar/event_rb.html
|
76
|
-
- html/files/lib/googlecalendar/service_auth_sub_rb.html
|
77
|
-
- html/files/lib/googlecalendar/service_base_rb.html
|
78
67
|
- html/files/lib/googlecalendar/service_rb.html
|
79
|
-
- html/files/
|
80
|
-
- html/
|
68
|
+
- html/files/lib/googlecalendar/service_base_rb.html
|
69
|
+
- html/files/lib/googlecalendar/calendar_rb.html
|
70
|
+
- html/files/lib/googlecalendar/auth_sub_util_rb.html
|
71
|
+
- html/files/lib/googlecalendar/service_auth_sub_rb.html
|
81
72
|
- html/fr_file_index.html
|
73
|
+
- html/created.rid
|
74
|
+
- html/rdoc-style.css
|
82
75
|
- html/fr_method_index.html
|
83
76
|
- html/index.html
|
84
|
-
- html/
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
- lib/googlecalendar/calendar.rb
|
90
|
-
- lib/googlecalendar/event.rb
|
91
|
-
- lib/googlecalendar/service.rb
|
92
|
-
- lib/googlecalendar/service_auth_sub.rb
|
93
|
-
- lib/googlecalendar/service_base.rb
|
94
|
-
- Rakefile
|
77
|
+
- html/fr_class_index.html
|
78
|
+
- example
|
79
|
+
- example/ol2gcal.rb
|
80
|
+
- example/mail2gcal.rb
|
81
|
+
- example/mixi2gcal.rb
|
95
82
|
- README
|
96
|
-
-
|
97
|
-
- test/00_service_test.rb
|
98
|
-
- test/01_calendar_test.rb
|
99
|
-
- test/02_event_test.rb
|
100
|
-
- test/03_authsub_test.rb
|
101
|
-
- test/all.sh
|
102
|
-
- test/base_unit.rb
|
103
|
-
- test/each.sh
|
104
|
-
- test/template.parameters.rb
|
105
|
-
- VERSION
|
106
|
-
- VERSION.BAK
|
83
|
+
- Rakefile
|
107
84
|
has_rdoc: true
|
108
85
|
homepage: http://gcalapi.rubyforge.net
|
109
86
|
post_install_message:
|
@@ -127,12 +104,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
104
|
requirements: []
|
128
105
|
|
129
106
|
rubyforge_project: gcalapi
|
130
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.3.1
|
131
108
|
signing_key:
|
132
109
|
specification_version: 2
|
133
110
|
summary: Google Calendar API
|
134
111
|
test_files:
|
135
|
-
- test/00_service_test.rb
|
136
|
-
- test/01_calendar_test.rb
|
137
112
|
- test/02_event_test.rb
|
138
113
|
- test/03_authsub_test.rb
|
114
|
+
- test/00_service_test.rb
|
115
|
+
- test/01_calendar_test.rb
|
data/VERSION.BAK
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.0
|