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
@@ -1,210 +1,210 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: GoogleCalendar::AuthSubUtil</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">GoogleCalendar::AuthSubUtil</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/googlecalendar/auth_sub_util_rb.html">
|
59
|
-
lib/googlecalendar/auth_sub_util.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<h1>Summary</h1>
|
83
|
-
<p>
|
84
|
-
Helper class for AuthSub authentication. For detail, see <a
|
85
|
-
href="http://code.google.com/apis/accounts/AuthForWebApps.html">code.google.com/apis/accounts/AuthForWebApps.html</a>
|
86
|
-
Currently, this class is available for only unregistered website.
|
87
|
-
</p>
|
88
|
-
<h1>How to use this class</h1>
|
89
|
-
<h2>Show AuthSubRequest link to a user.</h2>
|
90
|
-
<pre>
|
91
|
-
First, you need to show your user an anchor to the AuthSubRequest. The user can get authentication token
|
92
|
-
in the page. And the user will redirect back to your Website with authentication token.
|
93
|
-
|
94
|
-
request_url = AuthSubUtil.build_request_url(next_url, AuthSubUtil::CALENDAR_SCOPE, use_secure, use_session)
|
95
|
-
</pre>
|
96
|
-
<h2>Get token from redirected URL.</h2>
|
97
|
-
<pre>
|
98
|
-
The redirected URL string contains one time session token. You can get the token using get_one_time_token method.
|
99
|
-
|
100
|
-
token = AuthSubUtil.get_one_time_token(urlstr)
|
101
|
-
</pre>
|
102
|
-
<h2>Get session token.</h2>
|
103
|
-
<pre>
|
104
|
-
You will get an one time token above process. Then you can get longtime living sessin token.
|
105
|
-
|
106
|
-
session = AuthSubUtil.exchange_session_token(one_time_token)
|
107
|
-
</pre>
|
108
|
-
<h2>make a <a href="ServiceAuthSub.html">ServiceAuthSub</a> instance instead of <a href="Service.html">Service</a>.</h2>
|
109
|
-
<pre>
|
110
|
-
srv = GoogleCalendar::ServiceAuthSub.new(session_token)
|
111
|
-
</pre>
|
112
|
-
<h2>Revoke session token.</h2>
|
113
|
-
<pre>
|
114
|
-
Google limits the number of session token per user. So you should revoke the session token after using.
|
115
|
-
|
116
|
-
AuthSubUtil.revoke_session_token(session_token)
|
117
|
-
</pre>
|
118
|
-
|
119
|
-
</div>
|
120
|
-
|
121
|
-
|
122
|
-
</div>
|
123
|
-
|
124
|
-
<div id="method-list">
|
125
|
-
<h3 class="section-bar">Methods</h3>
|
126
|
-
|
127
|
-
<div class="name-list">
|
128
|
-
<a href="#M000004">build_request_url</a>
|
129
|
-
<a href="#M000009">do_get_with_ssl</a>
|
130
|
-
<a href="#M000006">exchange_session_token</a>
|
131
|
-
<a href="#M000005">get_one_time_token</a>
|
132
|
-
<a href="#M000007">revoke_session_token</a>
|
133
|
-
<a href="#M000008">token_info</a>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
</div>
|
138
|
-
|
139
|
-
|
140
|
-
<!-- if includes -->
|
141
|
-
|
142
|
-
<div id="section">
|
143
|
-
|
144
|
-
|
145
|
-
<div id="constants-list">
|
146
|
-
<h3 class="section-bar">Constants</h3>
|
147
|
-
|
148
|
-
<div class="name-list">
|
149
|
-
<table summary="Constants">
|
150
|
-
<tr class="top-aligned-row context-row">
|
151
|
-
<td class="context-item-name">REQUEST_URL</td>
|
152
|
-
<td>=</td>
|
153
|
-
<td class="context-item-value">"https://www.google.com/accounts/AuthSubRequest"</td>
|
154
|
-
</tr>
|
155
|
-
<tr class="top-aligned-row context-row">
|
156
|
-
<td class="context-item-name">SESSION_URL</td>
|
157
|
-
<td>=</td>
|
158
|
-
<td class="context-item-value">"https://www.google.com/accounts/AuthSubSessionToken"</td>
|
159
|
-
</tr>
|
160
|
-
<tr class="top-aligned-row context-row">
|
161
|
-
<td class="context-item-name">REVOKE_URL</td>
|
162
|
-
<td>=</td>
|
163
|
-
<td class="context-item-value">"https://www.google.com/accounts/AuthSubRevokeToken"</td>
|
164
|
-
</tr>
|
165
|
-
<tr class="top-aligned-row context-row">
|
166
|
-
<td class="context-item-name">INFO_URL</td>
|
167
|
-
<td>=</td>
|
168
|
-
<td class="context-item-value">"https://www.google.com/accounts/AuthSubTokenInfo"</td>
|
169
|
-
</tr>
|
170
|
-
<tr class="top-aligned-row context-row">
|
171
|
-
<td class="context-item-name">CALENDAR_SCOPE</td>
|
172
|
-
<td>=</td>
|
173
|
-
<td class="context-item-value">"http://www.google.com/calendar/feeds/"</td>
|
174
|
-
</tr>
|
175
|
-
</table>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<!-- if method_list -->
|
185
|
-
<div id="methods">
|
186
|
-
<h3 class="section-bar">Public Class methods</h3>
|
187
|
-
|
188
|
-
<div id="method-M000004" class="method-detail">
|
189
|
-
<a name="M000004"></a>
|
190
|
-
|
191
|
-
<div class="method-heading">
|
192
|
-
<a href="#M000004" class="method-signature">
|
193
|
-
<span class="method-name">build_request_url</span><span class="method-args">(next_url, scope, use_secure, use_session)</span>
|
194
|
-
</a>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
<div class="method-description">
|
198
|
-
<p>
|
199
|
-
Build url for AuthSubRequest. <a
|
200
|
-
href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRequest">code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRequest</a>
|
201
|
-
Currently, secure token is not implemented.
|
202
|
-
</p>
|
203
|
-
<p><a class="source-toggle" href="#"
|
204
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
205
|
-
<div class="method-source-code" id="M000004-source">
|
206
|
-
<pre>
|
207
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 67</span>
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: GoogleCalendar::AuthSubUtil</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">GoogleCalendar::AuthSubUtil</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/googlecalendar/auth_sub_util_rb.html">
|
59
|
+
lib/googlecalendar/auth_sub_util.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<h1>Summary</h1>
|
83
|
+
<p>
|
84
|
+
Helper class for AuthSub authentication. For detail, see <a
|
85
|
+
href="http://code.google.com/apis/accounts/AuthForWebApps.html">code.google.com/apis/accounts/AuthForWebApps.html</a>
|
86
|
+
Currently, this class is available for only unregistered website.
|
87
|
+
</p>
|
88
|
+
<h1>How to use this class</h1>
|
89
|
+
<h2>Show AuthSubRequest link to a user.</h2>
|
90
|
+
<pre>
|
91
|
+
First, you need to show your user an anchor to the AuthSubRequest. The user can get authentication token
|
92
|
+
in the page. And the user will redirect back to your Website with authentication token.
|
93
|
+
|
94
|
+
request_url = AuthSubUtil.build_request_url(next_url, AuthSubUtil::CALENDAR_SCOPE, use_secure, use_session)
|
95
|
+
</pre>
|
96
|
+
<h2>Get token from redirected URL.</h2>
|
97
|
+
<pre>
|
98
|
+
The redirected URL string contains one time session token. You can get the token using get_one_time_token method.
|
99
|
+
|
100
|
+
token = AuthSubUtil.get_one_time_token(urlstr)
|
101
|
+
</pre>
|
102
|
+
<h2>Get session token.</h2>
|
103
|
+
<pre>
|
104
|
+
You will get an one time token above process. Then you can get longtime living sessin token.
|
105
|
+
|
106
|
+
session = AuthSubUtil.exchange_session_token(one_time_token)
|
107
|
+
</pre>
|
108
|
+
<h2>make a <a href="ServiceAuthSub.html">ServiceAuthSub</a> instance instead of <a href="Service.html">Service</a>.</h2>
|
109
|
+
<pre>
|
110
|
+
srv = GoogleCalendar::ServiceAuthSub.new(session_token)
|
111
|
+
</pre>
|
112
|
+
<h2>Revoke session token.</h2>
|
113
|
+
<pre>
|
114
|
+
Google limits the number of session token per user. So you should revoke the session token after using.
|
115
|
+
|
116
|
+
AuthSubUtil.revoke_session_token(session_token)
|
117
|
+
</pre>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="method-list">
|
125
|
+
<h3 class="section-bar">Methods</h3>
|
126
|
+
|
127
|
+
<div class="name-list">
|
128
|
+
<a href="#M000004">build_request_url</a>
|
129
|
+
<a href="#M000009">do_get_with_ssl</a>
|
130
|
+
<a href="#M000006">exchange_session_token</a>
|
131
|
+
<a href="#M000005">get_one_time_token</a>
|
132
|
+
<a href="#M000007">revoke_session_token</a>
|
133
|
+
<a href="#M000008">token_info</a>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
<!-- if includes -->
|
141
|
+
|
142
|
+
<div id="section">
|
143
|
+
|
144
|
+
|
145
|
+
<div id="constants-list">
|
146
|
+
<h3 class="section-bar">Constants</h3>
|
147
|
+
|
148
|
+
<div class="name-list">
|
149
|
+
<table summary="Constants">
|
150
|
+
<tr class="top-aligned-row context-row">
|
151
|
+
<td class="context-item-name">REQUEST_URL</td>
|
152
|
+
<td>=</td>
|
153
|
+
<td class="context-item-value">"https://www.google.com/accounts/AuthSubRequest"</td>
|
154
|
+
</tr>
|
155
|
+
<tr class="top-aligned-row context-row">
|
156
|
+
<td class="context-item-name">SESSION_URL</td>
|
157
|
+
<td>=</td>
|
158
|
+
<td class="context-item-value">"https://www.google.com/accounts/AuthSubSessionToken"</td>
|
159
|
+
</tr>
|
160
|
+
<tr class="top-aligned-row context-row">
|
161
|
+
<td class="context-item-name">REVOKE_URL</td>
|
162
|
+
<td>=</td>
|
163
|
+
<td class="context-item-value">"https://www.google.com/accounts/AuthSubRevokeToken"</td>
|
164
|
+
</tr>
|
165
|
+
<tr class="top-aligned-row context-row">
|
166
|
+
<td class="context-item-name">INFO_URL</td>
|
167
|
+
<td>=</td>
|
168
|
+
<td class="context-item-value">"https://www.google.com/accounts/AuthSubTokenInfo"</td>
|
169
|
+
</tr>
|
170
|
+
<tr class="top-aligned-row context-row">
|
171
|
+
<td class="context-item-name">CALENDAR_SCOPE</td>
|
172
|
+
<td>=</td>
|
173
|
+
<td class="context-item-value">"http://www.google.com/calendar/feeds/"</td>
|
174
|
+
</tr>
|
175
|
+
</table>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<!-- if method_list -->
|
185
|
+
<div id="methods">
|
186
|
+
<h3 class="section-bar">Public Class methods</h3>
|
187
|
+
|
188
|
+
<div id="method-M000004" class="method-detail">
|
189
|
+
<a name="M000004"></a>
|
190
|
+
|
191
|
+
<div class="method-heading">
|
192
|
+
<a href="#M000004" class="method-signature">
|
193
|
+
<span class="method-name">build_request_url</span><span class="method-args">(next_url, scope, use_secure, use_session)</span>
|
194
|
+
</a>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
<p>
|
199
|
+
Build url for AuthSubRequest. <a
|
200
|
+
href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRequest">code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRequest</a>
|
201
|
+
Currently, secure token is not implemented.
|
202
|
+
</p>
|
203
|
+
<p><a class="source-toggle" href="#"
|
204
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
205
|
+
<div class="method-source-code" id="M000004-source">
|
206
|
+
<pre>
|
207
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 67</span>
|
208
208
|
67: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">build_request_url</span>(<span class="ruby-identifier">next_url</span>, <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">use_secure</span>, <span class="ruby-identifier">use_session</span>)
|
209
209
|
68: <span class="ruby-identifier">hq</span> = [[<span class="ruby-value str">"next"</span>, <span class="ruby-identifier">next_url</span>],
|
210
210
|
69: [<span class="ruby-value str">"scope"</span>, <span class="ruby-constant">CALENDAR_SCOPE</span>],
|
@@ -212,33 +212,33 @@ Currently, secure token is not implemented.
|
|
212
212
|
71: [<span class="ruby-value str">"session"</span>, <span class="ruby-identifier">use_session</span> <span class="ruby-value">? </span><span class="ruby-value str">"1"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"0"</span>]]
|
213
213
|
72: <span class="ruby-identifier">query</span> = <span class="ruby-identifier">hq</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">elem</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{elem[0]}=#{CGI.escape(elem[1])}"</span> <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"&"</span>)
|
214
214
|
73: <span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{REQUEST_URL}?#{query}"</span>
|
215
|
-
74: <span class="ruby-keyword kw">end</span>
|
216
|
-
</pre>
|
217
|
-
</div>
|
218
|
-
</div>
|
219
|
-
</div>
|
220
|
-
|
221
|
-
<div id="method-M000006" class="method-detail">
|
222
|
-
<a name="M000006"></a>
|
223
|
-
|
224
|
-
<div class="method-heading">
|
225
|
-
<a href="#M000006" class="method-signature">
|
226
|
-
<span class="method-name">exchange_session_token</span><span class="method-args">(one_time_token)</span>
|
227
|
-
</a>
|
228
|
-
</div>
|
229
|
-
|
230
|
-
<div class="method-description">
|
231
|
-
<p>
|
232
|
-
Get session token. The authentication token you get by calling
|
233
|
-
AuthSubRequest is available only once. To get long-lived token, use this.
|
234
|
-
For detail, see <a
|
235
|
-
href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubSessionToken">code.google.com/apis/accounts/AuthForWebApps.html#AuthSubSessionToken</a>
|
236
|
-
</p>
|
237
|
-
<p><a class="source-toggle" href="#"
|
238
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
239
|
-
<div class="method-source-code" id="M000006-source">
|
240
|
-
<pre>
|
241
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 95</span>
|
215
|
+
74: <span class="ruby-keyword kw">end</span>
|
216
|
+
</pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="method-M000006" class="method-detail">
|
222
|
+
<a name="M000006"></a>
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<a href="#M000006" class="method-signature">
|
226
|
+
<span class="method-name">exchange_session_token</span><span class="method-args">(one_time_token)</span>
|
227
|
+
</a>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<div class="method-description">
|
231
|
+
<p>
|
232
|
+
Get session token. The authentication token you get by calling
|
233
|
+
AuthSubRequest is available only once. To get long-lived token, use this.
|
234
|
+
For detail, see <a
|
235
|
+
href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubSessionToken">code.google.com/apis/accounts/AuthForWebApps.html#AuthSubSessionToken</a>
|
236
|
+
</p>
|
237
|
+
<p><a class="source-toggle" href="#"
|
238
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
239
|
+
<div class="method-source-code" id="M000006-source">
|
240
|
+
<pre>
|
241
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 95</span>
|
242
242
|
95: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">exchange_session_token</span>(<span class="ruby-identifier">one_time_token</span>)
|
243
243
|
96: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_get_with_ssl</span>(<span class="ruby-constant">SESSION_URL</span>, <span class="ruby-identifier">one_time_token</span>)
|
244
244
|
97: <span class="ruby-identifier">throw</span> <span class="ruby-constant">AuthSubFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
@@ -249,92 +249,92 @@ href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubSessionTok
|
|
249
249
|
102: <span class="ruby-identifier">throw</span> <span class="ruby-constant">AuthSubFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>), <span class="ruby-value str">"Token not found"</span>
|
250
250
|
103: <span class="ruby-keyword kw">end</span>
|
251
251
|
104: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">session_token</span>
|
252
|
-
105: <span class="ruby-keyword kw">end</span>
|
253
|
-
</pre>
|
254
|
-
</div>
|
255
|
-
</div>
|
256
|
-
</div>
|
257
|
-
|
258
|
-
<div id="method-M000005" class="method-detail">
|
259
|
-
<a name="M000005"></a>
|
260
|
-
|
261
|
-
<div class="method-heading">
|
262
|
-
<a href="#M000005" class="method-signature">
|
263
|
-
<span class="method-name">get_one_time_token</span><span class="method-args">(url_str)</span>
|
264
|
-
</a>
|
265
|
-
</div>
|
266
|
-
|
267
|
-
<div class="method-description">
|
268
|
-
<p>
|
269
|
-
Get authentication token from the redirected url. When the AuthSubRequest
|
270
|
-
is accepted, the edirected URL string (specified in next_url parameter of
|
271
|
-
build_reque4st_url method) contains authentication token. This method
|
272
|
-
retrieves the token from url string. This token is for a single use only.
|
273
|
-
To get long-lived token, use <a
|
274
|
-
href="AuthSubUtil.html#M000006">exchange_session_token</a> method.
|
275
|
-
</p>
|
276
|
-
<p><a class="source-toggle" href="#"
|
277
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
278
|
-
<div class="method-source-code" id="M000005-source">
|
279
|
-
<pre>
|
280
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 82</span>
|
252
|
+
105: <span class="ruby-keyword kw">end</span>
|
253
|
+
</pre>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
<div id="method-M000005" class="method-detail">
|
259
|
+
<a name="M000005"></a>
|
260
|
+
|
261
|
+
<div class="method-heading">
|
262
|
+
<a href="#M000005" class="method-signature">
|
263
|
+
<span class="method-name">get_one_time_token</span><span class="method-args">(url_str)</span>
|
264
|
+
</a>
|
265
|
+
</div>
|
266
|
+
|
267
|
+
<div class="method-description">
|
268
|
+
<p>
|
269
|
+
Get authentication token from the redirected url. When the AuthSubRequest
|
270
|
+
is accepted, the edirected URL string (specified in next_url parameter of
|
271
|
+
build_reque4st_url method) contains authentication token. This method
|
272
|
+
retrieves the token from url string. This token is for a single use only.
|
273
|
+
To get long-lived token, use <a
|
274
|
+
href="AuthSubUtil.html#M000006">exchange_session_token</a> method.
|
275
|
+
</p>
|
276
|
+
<p><a class="source-toggle" href="#"
|
277
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
278
|
+
<div class="method-source-code" id="M000005-source">
|
279
|
+
<pre>
|
280
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 82</span>
|
281
281
|
82: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_one_time_token</span>(<span class="ruby-identifier">url_str</span>)
|
282
282
|
83: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url_str</span>)
|
283
283
|
84: <span class="ruby-identifier">params</span> = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>)
|
284
284
|
85: <span class="ruby-identifier">throw</span> <span class="ruby-constant">AuthSubFailed</span>, <span class="ruby-value str">"Token is not found"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"token"</span>)
|
285
285
|
86: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>[<span class="ruby-value str">"token"</span>][<span class="ruby-value">0</span>]
|
286
|
-
87: <span class="ruby-keyword kw">end</span>
|
287
|
-
</pre>
|
288
|
-
</div>
|
289
|
-
</div>
|
290
|
-
</div>
|
291
|
-
|
292
|
-
<div id="method-M000007" class="method-detail">
|
293
|
-
<a name="M000007"></a>
|
294
|
-
|
295
|
-
<div class="method-heading">
|
296
|
-
<a href="#M000007" class="method-signature">
|
297
|
-
<span class="method-name">revoke_session_token</span><span class="method-args">(session_token)</span>
|
298
|
-
</a>
|
299
|
-
</div>
|
300
|
-
|
301
|
-
<div class="method-description">
|
302
|
-
<p>
|
303
|
-
You can get session token by calling <a
|
304
|
-
href="AuthSubUtil.html#M000006">exchange_session_token</a> method. Session
|
305
|
-
token will remain until you revoke. For detail, <a
|
306
|
-
href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRevokeToken">code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRevokeToken</a>
|
307
|
-
</p>
|
308
|
-
<p><a class="source-toggle" href="#"
|
309
|
-
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
310
|
-
<div class="method-source-code" id="M000007-source">
|
311
|
-
<pre>
|
312
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 112</span>
|
286
|
+
87: <span class="ruby-keyword kw">end</span>
|
287
|
+
</pre>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div id="method-M000007" class="method-detail">
|
293
|
+
<a name="M000007"></a>
|
294
|
+
|
295
|
+
<div class="method-heading">
|
296
|
+
<a href="#M000007" class="method-signature">
|
297
|
+
<span class="method-name">revoke_session_token</span><span class="method-args">(session_token)</span>
|
298
|
+
</a>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div class="method-description">
|
302
|
+
<p>
|
303
|
+
You can get session token by calling <a
|
304
|
+
href="AuthSubUtil.html#M000006">exchange_session_token</a> method. Session
|
305
|
+
token will remain until you revoke. For detail, <a
|
306
|
+
href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRevokeToken">code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRevokeToken</a>
|
307
|
+
</p>
|
308
|
+
<p><a class="source-toggle" href="#"
|
309
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
310
|
+
<div class="method-source-code" id="M000007-source">
|
311
|
+
<pre>
|
312
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 112</span>
|
313
313
|
112: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">revoke_session_token</span>(<span class="ruby-identifier">session_token</span>)
|
314
314
|
113: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_get_with_ssl</span>(<span class="ruby-constant">REVOKE_URL</span>, <span class="ruby-identifier">session_token</span>)
|
315
315
|
114: <span class="ruby-identifier">throw</span> <span class="ruby-constant">AuthSubFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
316
316
|
115: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span>
|
317
|
-
116: <span class="ruby-keyword kw">end</span>
|
318
|
-
</pre>
|
319
|
-
</div>
|
320
|
-
</div>
|
321
|
-
</div>
|
322
|
-
|
323
|
-
<div id="method-M000008" class="method-detail">
|
324
|
-
<a name="M000008"></a>
|
325
|
-
|
326
|
-
<div class="method-heading">
|
327
|
-
<a href="#M000008" class="method-signature">
|
328
|
-
<span class="method-name">token_info</span><span class="method-args">(session_token)</span>
|
329
|
-
</a>
|
330
|
-
</div>
|
331
|
-
|
332
|
-
<div class="method-description">
|
333
|
-
<p><a class="source-toggle" href="#"
|
334
|
-
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
335
|
-
<div class="method-source-code" id="M000008-source">
|
336
|
-
<pre>
|
337
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 119</span>
|
317
|
+
116: <span class="ruby-keyword kw">end</span>
|
318
|
+
</pre>
|
319
|
+
</div>
|
320
|
+
</div>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<div id="method-M000008" class="method-detail">
|
324
|
+
<a name="M000008"></a>
|
325
|
+
|
326
|
+
<div class="method-heading">
|
327
|
+
<a href="#M000008" class="method-signature">
|
328
|
+
<span class="method-name">token_info</span><span class="method-args">(session_token)</span>
|
329
|
+
</a>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div class="method-description">
|
333
|
+
<p><a class="source-toggle" href="#"
|
334
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
335
|
+
<div class="method-source-code" id="M000008-source">
|
336
|
+
<pre>
|
337
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 119</span>
|
338
338
|
119: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">token_info</span>(<span class="ruby-identifier">session_token</span>)
|
339
339
|
120: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_get_with_ssl</span>(<span class="ruby-constant">INFO_URL</span>, <span class="ruby-identifier">session_token</span>)
|
340
340
|
121: <span class="ruby-identifier">throw</span> <span class="ruby-constant">AuthSubFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">res</span>), <span class="ruby-identifier">res</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
@@ -343,29 +343,29 @@ href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRevokeToke
|
|
343
343
|
124: <span class="ruby-identifier">ret</span>[<span class="ruby-identifier">$1</span>] = <span class="ruby-identifier">$2</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^([^=]+)=(.+)$/</span>
|
344
344
|
125: <span class="ruby-keyword kw">end</span>
|
345
345
|
126: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret</span>
|
346
|
-
127: <span class="ruby-keyword kw">end</span>
|
347
|
-
</pre>
|
348
|
-
</div>
|
349
|
-
</div>
|
350
|
-
</div>
|
351
|
-
|
352
|
-
<h3 class="section-bar">Private Class methods</h3>
|
353
|
-
|
354
|
-
<div id="method-M000009" class="method-detail">
|
355
|
-
<a name="M000009"></a>
|
356
|
-
|
357
|
-
<div class="method-heading">
|
358
|
-
<a href="#M000009" class="method-signature">
|
359
|
-
<span class="method-name">do_get_with_ssl</span><span class="method-args">(str_uri, token)</span>
|
360
|
-
</a>
|
361
|
-
</div>
|
362
|
-
|
363
|
-
<div class="method-description">
|
364
|
-
<p><a class="source-toggle" href="#"
|
365
|
-
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
366
|
-
<div class="method-source-code" id="M000009-source">
|
367
|
-
<pre>
|
368
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 131</span>
|
346
|
+
127: <span class="ruby-keyword kw">end</span>
|
347
|
+
</pre>
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
<h3 class="section-bar">Private Class methods</h3>
|
353
|
+
|
354
|
+
<div id="method-M000009" class="method-detail">
|
355
|
+
<a name="M000009"></a>
|
356
|
+
|
357
|
+
<div class="method-heading">
|
358
|
+
<a href="#M000009" class="method-signature">
|
359
|
+
<span class="method-name">do_get_with_ssl</span><span class="method-args">(str_uri, token)</span>
|
360
|
+
</a>
|
361
|
+
</div>
|
362
|
+
|
363
|
+
<div class="method-description">
|
364
|
+
<p><a class="source-toggle" href="#"
|
365
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
366
|
+
<div class="method-source-code" id="M000009-source">
|
367
|
+
<pre>
|
368
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/auth_sub_util.rb, line 131</span>
|
369
369
|
131: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">do_get_with_ssl</span>(<span class="ruby-identifier">str_uri</span>, <span class="ruby-identifier">token</span>)
|
370
370
|
132: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
371
371
|
133: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">str_uri</span>)
|
@@ -376,22 +376,22 @@ href="http://code.google.com/apis/accounts/AuthForWebApps.html#AuthSubRevokeToke
|
|
376
376
|
138: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>, {<span class="ruby-value str">"Authorization"</span> =<span class="ruby-operator">></span> <span class="ruby-node">"AuthSub token=\"#{token}\""</span>})
|
377
377
|
139: <span class="ruby-keyword kw">end</span>
|
378
378
|
140: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span>
|
379
|
-
141: <span class="ruby-keyword kw">end</span>
|
380
|
-
</pre>
|
381
|
-
</div>
|
382
|
-
</div>
|
383
|
-
</div>
|
384
|
-
|
385
|
-
|
386
|
-
</div>
|
387
|
-
|
388
|
-
|
389
|
-
</div>
|
390
|
-
|
391
|
-
|
392
|
-
<div id="validator-badges">
|
393
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
394
|
-
</div>
|
395
|
-
|
396
|
-
</body>
|
379
|
+
141: <span class="ruby-keyword kw">end</span>
|
380
|
+
</pre>
|
381
|
+
</div>
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
|
386
|
+
</div>
|
387
|
+
|
388
|
+
|
389
|
+
</div>
|
390
|
+
|
391
|
+
|
392
|
+
<div id="validator-badges">
|
393
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
</body>
|
397
397
|
</html>
|