gcalapi 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +19 -15
- data/VERSION +1 -1
- data/example/mixi2gcal.rb +88 -0
- data/html/classes/GoogleCalendar.html +149 -280
- data/html/classes/GoogleCalendar/AuthSubFailed.html +165 -0
- data/html/classes/GoogleCalendar/AuthSubUtil.html +397 -0
- data/html/classes/GoogleCalendar/AuthenticationFailed.html +110 -110
- data/html/classes/GoogleCalendar/Calendar.html +381 -203
- data/html/classes/GoogleCalendar/Event.html +800 -510
- data/html/classes/GoogleCalendar/EventDeleteFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventGetFailed.html +111 -0
- 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 +305 -594
- data/html/classes/GoogleCalendar/ServiceAuthSub.html +181 -0
- data/html/classes/GoogleCalendar/ServiceBase.html +694 -0
- data/html/created.rid +1 -1
- data/html/files/README.html +116 -116
- data/html/files/lib/googlecalendar/auth_sub_util_rb.html +111 -0
- 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 +108 -0
- data/html/files/lib/googlecalendar/service_base_rb.html +114 -0
- data/html/files/lib/googlecalendar/service_rb.html +107 -113
- data/html/fr_class_index.html +39 -34
- data/html/fr_file_index.html +32 -29
- data/html/fr_method_index.html +75 -52
- data/html/index.html +23 -23
- data/html/rdoc-style.css +207 -207
- data/lib/googlecalendar/auth_sub_util.rb +143 -0
- data/lib/googlecalendar/calendar.rb +48 -36
- data/lib/googlecalendar/event.rb +16 -11
- data/lib/googlecalendar/service.rb +30 -180
- data/lib/googlecalendar/service_auth_sub.rb +18 -0
- data/lib/googlecalendar/service_base.rb +197 -0
- data/test/00_service_test.rb +2 -1
- data/test/01_calendar_test.rb +1 -1
- data/test/02_event_test.rb +28 -1
- data/test/03_authsub_test.rb +119 -0
- data/test/base_unit.rb +3 -0
- metadata +105 -62
@@ -0,0 +1,181 @@
|
|
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::ServiceAuthSub</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::ServiceAuthSub</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/googlecalendar/service_auth_sub_rb.html">
|
59
|
+
lib/googlecalendar/service_auth_sub.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
|
+
<a href="ServiceBase.html">
|
69
|
+
ServiceBase
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
this class interacts with Google <a href="Calendar.html">Calendar</a> and
|
86
|
+
uses AuthSub interface for authentication.
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000002">add_authorize_header</a>
|
99
|
+
<a href="#M000001">new</a>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
<!-- if includes -->
|
107
|
+
|
108
|
+
<div id="section">
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<!-- if method_list -->
|
118
|
+
<div id="methods">
|
119
|
+
<h3 class="section-bar">Public Class methods</h3>
|
120
|
+
|
121
|
+
<div id="method-M000001" class="method-detail">
|
122
|
+
<a name="M000001"></a>
|
123
|
+
|
124
|
+
<div class="method-heading">
|
125
|
+
<a href="#M000001" class="method-signature">
|
126
|
+
<span class="method-name">new</span><span class="method-args">(token)</span>
|
127
|
+
</a>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="method-description">
|
131
|
+
<p><a class="source-toggle" href="#"
|
132
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
133
|
+
<div class="method-source-code" id="M000001-source">
|
134
|
+
<pre>
|
135
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_auth_sub.rb, line 9</span>
|
136
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">token</span>)
|
137
|
+
10: <span class="ruby-ivar">@auth</span> = <span class="ruby-identifier">token</span>
|
138
|
+
11: <span class="ruby-keyword kw">end</span>
|
139
|
+
</pre>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
145
|
+
|
146
|
+
<div id="method-M000002" class="method-detail">
|
147
|
+
<a name="M000002"></a>
|
148
|
+
|
149
|
+
<div class="method-heading">
|
150
|
+
<a href="#M000002" class="method-signature">
|
151
|
+
<span class="method-name">add_authorize_header</span><span class="method-args">(header)</span>
|
152
|
+
</a>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div class="method-description">
|
156
|
+
<p><a class="source-toggle" href="#"
|
157
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
158
|
+
<div class="method-source-code" id="M000002-source">
|
159
|
+
<pre>
|
160
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_auth_sub.rb, line 14</span>
|
161
|
+
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_authorize_header</span>(<span class="ruby-identifier">header</span>)
|
162
|
+
15: <span class="ruby-identifier">header</span>[<span class="ruby-value str">"Authorization"</span>] = <span class="ruby-node">"AuthSub token=#{@auth}"</span>
|
163
|
+
16: <span class="ruby-keyword kw">end</span>
|
164
|
+
</pre>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
</div>
|
174
|
+
|
175
|
+
|
176
|
+
<div id="validator-badges">
|
177
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
</body>
|
181
|
+
</html>
|
@@ -0,0 +1,694 @@
|
|
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::ServiceBase</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::ServiceBase</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/googlecalendar/service_base_rb.html">
|
59
|
+
lib/googlecalendar/service_base.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
|
+
<p>
|
83
|
+
This class interacts with google calendar service.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000041">auth</a>
|
96
|
+
<a href="#M000038">delete</a>
|
97
|
+
<a href="#M000043">do_get</a>
|
98
|
+
<a href="#M000042">do_post</a>
|
99
|
+
<a href="#M000039">insert</a>
|
100
|
+
<a href="#M000045">path_with_authorized_query</a>
|
101
|
+
<a href="#M000029">proxy_addr</a>
|
102
|
+
<a href="#M000030">proxy_addr=</a>
|
103
|
+
<a href="#M000035">proxy_pass</a>
|
104
|
+
<a href="#M000036">proxy_pass=</a>
|
105
|
+
<a href="#M000031">proxy_port</a>
|
106
|
+
<a href="#M000032">proxy_port=</a>
|
107
|
+
<a href="#M000033">proxy_user</a>
|
108
|
+
<a href="#M000034">proxy_user=</a>
|
109
|
+
<a href="#M000037">query</a>
|
110
|
+
<a href="#M000044">try_http</a>
|
111
|
+
<a href="#M000040">update</a>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
<!-- if includes -->
|
119
|
+
|
120
|
+
<div id="section">
|
121
|
+
|
122
|
+
|
123
|
+
<div id="constants-list">
|
124
|
+
<h3 class="section-bar">Constants</h3>
|
125
|
+
|
126
|
+
<div class="name-list">
|
127
|
+
<table summary="Constants">
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">AUTH_SERVER</td>
|
130
|
+
<td>=</td>
|
131
|
+
<td class="context-item-value">"www.google.com"</td>
|
132
|
+
<td width="3em"> </td>
|
133
|
+
<td class="context-item-desc">
|
134
|
+
Server name to Authenticate
|
135
|
+
|
136
|
+
</td>
|
137
|
+
</tr>
|
138
|
+
</table>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<div id="attribute-list">
|
145
|
+
<h3 class="section-bar">Attributes</h3>
|
146
|
+
|
147
|
+
<div class="name-list">
|
148
|
+
<table>
|
149
|
+
<tr class="top-aligned-row context-row">
|
150
|
+
<td class="context-item-name">logger</td>
|
151
|
+
<td class="context-item-value"> [RW] </td>
|
152
|
+
<td class="context-item-desc"></td>
|
153
|
+
</tr>
|
154
|
+
</table>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<!-- if method_list -->
|
161
|
+
<div id="methods">
|
162
|
+
<h3 class="section-bar">Public Class methods</h3>
|
163
|
+
|
164
|
+
<div id="method-M000029" class="method-detail">
|
165
|
+
<a name="M000029"></a>
|
166
|
+
|
167
|
+
<div class="method-heading">
|
168
|
+
<a href="#M000029" class="method-signature">
|
169
|
+
<span class="method-name">proxy_addr</span><span class="method-args">()</span>
|
170
|
+
</a>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div class="method-description">
|
174
|
+
<p><a class="source-toggle" href="#"
|
175
|
+
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
176
|
+
<div class="method-source-code" id="M000029-source">
|
177
|
+
<pre>
|
178
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 24</span>
|
179
|
+
24: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_addr</span>
|
180
|
+
25: <span class="ruby-ivar">@@proxy_addr</span>
|
181
|
+
26: <span class="ruby-keyword kw">end</span>
|
182
|
+
</pre>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div id="method-M000030" class="method-detail">
|
188
|
+
<a name="M000030"></a>
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<a href="#M000030" class="method-signature">
|
192
|
+
<span class="method-name">proxy_addr=</span><span class="method-args">(addr)</span>
|
193
|
+
</a>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="method-description">
|
197
|
+
<p><a class="source-toggle" href="#"
|
198
|
+
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
199
|
+
<div class="method-source-code" id="M000030-source">
|
200
|
+
<pre>
|
201
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 28</span>
|
202
|
+
28: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_addr=</span>(<span class="ruby-identifier">addr</span>)
|
203
|
+
29: <span class="ruby-ivar">@@proxy_addr</span>=<span class="ruby-identifier">addr</span>
|
204
|
+
30: <span class="ruby-keyword kw">end</span>
|
205
|
+
</pre>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div id="method-M000035" class="method-detail">
|
211
|
+
<a name="M000035"></a>
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<a href="#M000035" class="method-signature">
|
215
|
+
<span class="method-name">proxy_pass</span><span class="method-args">()</span>
|
216
|
+
</a>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method-description">
|
220
|
+
<p><a class="source-toggle" href="#"
|
221
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000035-source">
|
223
|
+
<pre>
|
224
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 54</span>
|
225
|
+
54: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_pass</span>
|
226
|
+
55: <span class="ruby-ivar">@@proxy_pass</span>
|
227
|
+
56: <span class="ruby-keyword kw">end</span>
|
228
|
+
</pre>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="method-M000036" class="method-detail">
|
234
|
+
<a name="M000036"></a>
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<a href="#M000036" class="method-signature">
|
238
|
+
<span class="method-name">proxy_pass=</span><span class="method-args">(pass)</span>
|
239
|
+
</a>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="method-description">
|
243
|
+
<p><a class="source-toggle" href="#"
|
244
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
245
|
+
<div class="method-source-code" id="M000036-source">
|
246
|
+
<pre>
|
247
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 58</span>
|
248
|
+
58: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_pass=</span>(<span class="ruby-identifier">pass</span>)
|
249
|
+
59: <span class="ruby-ivar">@@proxy_pass</span> = <span class="ruby-identifier">pass</span>
|
250
|
+
60: <span class="ruby-keyword kw">end</span>
|
251
|
+
</pre>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div id="method-M000031" class="method-detail">
|
257
|
+
<a name="M000031"></a>
|
258
|
+
|
259
|
+
<div class="method-heading">
|
260
|
+
<a href="#M000031" class="method-signature">
|
261
|
+
<span class="method-name">proxy_port</span><span class="method-args">()</span>
|
262
|
+
</a>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div class="method-description">
|
266
|
+
<p><a class="source-toggle" href="#"
|
267
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
268
|
+
<div class="method-source-code" id="M000031-source">
|
269
|
+
<pre>
|
270
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 34</span>
|
271
|
+
34: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_port</span>
|
272
|
+
35: <span class="ruby-ivar">@@proxy_port</span>
|
273
|
+
36: <span class="ruby-keyword kw">end</span>
|
274
|
+
</pre>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div id="method-M000032" class="method-detail">
|
280
|
+
<a name="M000032"></a>
|
281
|
+
|
282
|
+
<div class="method-heading">
|
283
|
+
<a href="#M000032" class="method-signature">
|
284
|
+
<span class="method-name">proxy_port=</span><span class="method-args">(port)</span>
|
285
|
+
</a>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div class="method-description">
|
289
|
+
<p><a class="source-toggle" href="#"
|
290
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
291
|
+
<div class="method-source-code" id="M000032-source">
|
292
|
+
<pre>
|
293
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 38</span>
|
294
|
+
38: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_port=</span>(<span class="ruby-identifier">port</span>)
|
295
|
+
39: <span class="ruby-ivar">@@proxy_port</span> = <span class="ruby-identifier">port</span>
|
296
|
+
40: <span class="ruby-keyword kw">end</span>
|
297
|
+
</pre>
|
298
|
+
</div>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
<div id="method-M000033" class="method-detail">
|
303
|
+
<a name="M000033"></a>
|
304
|
+
|
305
|
+
<div class="method-heading">
|
306
|
+
<a href="#M000033" class="method-signature">
|
307
|
+
<span class="method-name">proxy_user</span><span class="method-args">()</span>
|
308
|
+
</a>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
<div class="method-description">
|
312
|
+
<p><a class="source-toggle" href="#"
|
313
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
314
|
+
<div class="method-source-code" id="M000033-source">
|
315
|
+
<pre>
|
316
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 44</span>
|
317
|
+
44: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_user</span>
|
318
|
+
45: <span class="ruby-ivar">@@proxy_user</span>
|
319
|
+
46: <span class="ruby-keyword kw">end</span>
|
320
|
+
</pre>
|
321
|
+
</div>
|
322
|
+
</div>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<div id="method-M000034" class="method-detail">
|
326
|
+
<a name="M000034"></a>
|
327
|
+
|
328
|
+
<div class="method-heading">
|
329
|
+
<a href="#M000034" class="method-signature">
|
330
|
+
<span class="method-name">proxy_user=</span><span class="method-args">(user)</span>
|
331
|
+
</a>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
<div class="method-description">
|
335
|
+
<p><a class="source-toggle" href="#"
|
336
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
337
|
+
<div class="method-source-code" id="M000034-source">
|
338
|
+
<pre>
|
339
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 48</span>
|
340
|
+
48: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxy_user=</span>(<span class="ruby-identifier">user</span>)
|
341
|
+
49: <span class="ruby-ivar">@@proxy_user</span> = <span class="ruby-identifier">user</span>
|
342
|
+
50: <span class="ruby-keyword kw">end</span>
|
343
|
+
</pre>
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
</div>
|
347
|
+
|
348
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
349
|
+
|
350
|
+
<div id="method-M000038" class="method-detail">
|
351
|
+
<a name="M000038"></a>
|
352
|
+
|
353
|
+
<div class="method-heading">
|
354
|
+
<a href="#M000038" class="method-signature">
|
355
|
+
<span class="method-name">delete</span><span class="method-args">(feed)</span>
|
356
|
+
</a>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div class="method-description">
|
360
|
+
<p>
|
361
|
+
<a href="ServiceBase.html#M000038">delete</a> an event.
|
362
|
+
</p>
|
363
|
+
<p><a class="source-toggle" href="#"
|
364
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
365
|
+
<div class="method-source-code" id="M000038-source">
|
366
|
+
<pre>
|
367
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 95</span>
|
368
|
+
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">feed</span>)
|
369
|
+
96: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- delete st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
370
|
+
97: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
371
|
+
98: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">feed</span>)
|
372
|
+
99: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>,
|
373
|
+
100: {<span class="ruby-value str">"X-HTTP-Method-Override"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"DELETE"</span>},
|
374
|
+
101: <span class="ruby-value str">"DELETE "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
|
375
|
+
102: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- delete en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
376
|
+
103: <span class="ruby-identifier">res</span>
|
377
|
+
104: <span class="ruby-keyword kw">end</span>
|
378
|
+
</pre>
|
379
|
+
</div>
|
380
|
+
</div>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
<div id="method-M000039" class="method-detail">
|
384
|
+
<a name="M000039"></a>
|
385
|
+
|
386
|
+
<div class="method-heading">
|
387
|
+
<a href="#M000039" class="method-signature">
|
388
|
+
<span class="method-name">insert</span><span class="method-args">(feed, event)</span>
|
389
|
+
</a>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div class="method-description">
|
393
|
+
<p>
|
394
|
+
<a href="ServiceBase.html#M000039">insert</a> an event
|
395
|
+
</p>
|
396
|
+
<p><a class="source-toggle" href="#"
|
397
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
398
|
+
<div class="method-source-code" id="M000039-source">
|
399
|
+
<pre>
|
400
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 109</span>
|
401
|
+
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert</span>(<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">event</span>)
|
402
|
+
110: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- insert st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
403
|
+
111: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
404
|
+
112: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">feed</span>)
|
405
|
+
113: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>,
|
406
|
+
114: {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/atom+xml"</span>,
|
407
|
+
115: <span class="ruby-value str">"Content-Length"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>}, <span class="ruby-identifier">event</span>)
|
408
|
+
116: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- insert en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
409
|
+
117: <span class="ruby-identifier">res</span>
|
410
|
+
118: <span class="ruby-keyword kw">end</span>
|
411
|
+
</pre>
|
412
|
+
</div>
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
|
416
|
+
<div id="method-M000037" class="method-detail">
|
417
|
+
<a name="M000037"></a>
|
418
|
+
|
419
|
+
<div class="method-heading">
|
420
|
+
<a href="#M000037" class="method-signature">
|
421
|
+
<span class="method-name">query</span><span class="method-args">(cal_url, conditions = nil)</span>
|
422
|
+
</a>
|
423
|
+
</div>
|
424
|
+
|
425
|
+
<div class="method-description">
|
426
|
+
<p>
|
427
|
+
send <a href="ServiceBase.html#M000037">query</a> for events of a calendar
|
428
|
+
and returns http response object. available condtions are
|
429
|
+
</p>
|
430
|
+
<ul>
|
431
|
+
<li>:q => <a href="ServiceBase.html#M000037">query</a> string
|
432
|
+
|
433
|
+
</li>
|
434
|
+
<li>:max-results => max contents count. (default: 25)
|
435
|
+
|
436
|
+
</li>
|
437
|
+
<li>:start-index => 1-based index of the first result to be retrieved
|
438
|
+
|
439
|
+
</li>
|
440
|
+
<li>:orderby => the order of retrieved data.
|
441
|
+
|
442
|
+
</li>
|
443
|
+
<li>:published-min => Bounds on the entry publication date(oldest)
|
444
|
+
|
445
|
+
</li>
|
446
|
+
<li>:published-max => Bounds on the entry publication date(newest)
|
447
|
+
|
448
|
+
</li>
|
449
|
+
<li>:updated-min => Bounds on the entry <a
|
450
|
+
href="ServiceBase.html#M000040">update</a> date(oldest)
|
451
|
+
|
452
|
+
</li>
|
453
|
+
<li>:updated-max => Bounds on the entry <a
|
454
|
+
href="ServiceBase.html#M000040">update</a> date(newest)
|
455
|
+
|
456
|
+
</li>
|
457
|
+
<li>:author => Entry author
|
458
|
+
|
459
|
+
</li>
|
460
|
+
</ul>
|
461
|
+
<p>
|
462
|
+
and so on. For detail, see <a
|
463
|
+
href="http://code.google.com/apis/gdata/protocol.html#Queries">code.google.com/apis/gdata/protocol.html#Queries</a>
|
464
|
+
</p>
|
465
|
+
<pre>
|
466
|
+
and http://code.google.com/apis/calendar/reference.html#Parameters
|
467
|
+
</pre>
|
468
|
+
<p><a class="source-toggle" href="#"
|
469
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
470
|
+
<div class="method-source-code" id="M000037-source">
|
471
|
+
<pre>
|
472
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 80</span>
|
473
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>(<span class="ruby-identifier">cal_url</span>, <span class="ruby-identifier">conditions</span> = <span class="ruby-keyword kw">nil</span>)
|
474
|
+
81: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- query st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
475
|
+
82: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
476
|
+
83: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">cal_url</span>)
|
477
|
+
84: <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span> = <span class="ruby-identifier">conditions</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
478
|
+
85: <span class="ruby-node">"#{key}=#{URI.escape(val.kind_of?(Time) ? val.getutc.iso8601 : val.to_s)}"</span>
|
479
|
+
86: <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"&"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">conditions</span>.<span class="ruby-identifier">nil?</span>
|
480
|
+
87: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_get</span>(<span class="ruby-identifier">uri</span>, {})
|
481
|
+
88: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- query en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
482
|
+
89: <span class="ruby-identifier">res</span>
|
483
|
+
90: <span class="ruby-keyword kw">end</span>
|
484
|
+
</pre>
|
485
|
+
</div>
|
486
|
+
</div>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
<div id="method-M000040" class="method-detail">
|
490
|
+
<a name="M000040"></a>
|
491
|
+
|
492
|
+
<div class="method-heading">
|
493
|
+
<a href="#M000040" class="method-signature">
|
494
|
+
<span class="method-name">update</span><span class="method-args">(feed, event)</span>
|
495
|
+
</a>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
<div class="method-description">
|
499
|
+
<p>
|
500
|
+
<a href="ServiceBase.html#M000040">update</a> an event.
|
501
|
+
</p>
|
502
|
+
<p><a class="source-toggle" href="#"
|
503
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
504
|
+
<div class="method-source-code" id="M000040-source">
|
505
|
+
<pre>
|
506
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 123</span>
|
507
|
+
123: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">event</span>)
|
508
|
+
124: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- update st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
509
|
+
125: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
510
|
+
126: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">feed</span>)
|
511
|
+
127: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>,
|
512
|
+
128: {<span class="ruby-value str">"X-HTTP-Method-Override"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"PUT"</span>,
|
513
|
+
129: <span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/atom+xml"</span>,
|
514
|
+
130: <span class="ruby-value str">"Content-Length"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>}, <span class="ruby-identifier">event</span>)
|
515
|
+
131: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- update en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
516
|
+
132: <span class="ruby-identifier">res</span>
|
517
|
+
133: <span class="ruby-keyword kw">end</span>
|
518
|
+
</pre>
|
519
|
+
</div>
|
520
|
+
</div>
|
521
|
+
</div>
|
522
|
+
|
523
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
524
|
+
|
525
|
+
<div id="method-M000041" class="method-detail">
|
526
|
+
<a name="M000041"></a>
|
527
|
+
|
528
|
+
<div class="method-heading">
|
529
|
+
<a href="#M000041" class="method-signature">
|
530
|
+
<span class="method-name">auth</span><span class="method-args">()</span>
|
531
|
+
</a>
|
532
|
+
</div>
|
533
|
+
|
534
|
+
<div class="method-description">
|
535
|
+
<p>
|
536
|
+
authencate
|
537
|
+
</p>
|
538
|
+
<p><a class="source-toggle" href="#"
|
539
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
540
|
+
<div class="method-source-code" id="M000041-source">
|
541
|
+
<pre>
|
542
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 138</span>
|
543
|
+
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auth</span>
|
544
|
+
139: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuthenticationFailed</span>
|
545
|
+
140: <span class="ruby-keyword kw">end</span>
|
546
|
+
</pre>
|
547
|
+
</div>
|
548
|
+
</div>
|
549
|
+
</div>
|
550
|
+
|
551
|
+
<div id="method-M000043" class="method-detail">
|
552
|
+
<a name="M000043"></a>
|
553
|
+
|
554
|
+
<div class="method-heading">
|
555
|
+
<a href="#M000043" class="method-signature">
|
556
|
+
<span class="method-name">do_get</span><span class="method-args">(uri, header)</span>
|
557
|
+
</a>
|
558
|
+
</div>
|
559
|
+
|
560
|
+
<div class="method-description">
|
561
|
+
<p><a class="source-toggle" href="#"
|
562
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
563
|
+
<div class="method-source-code" id="M000043-source">
|
564
|
+
<pre>
|
565
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 152</span>
|
566
|
+
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_get</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>)
|
567
|
+
153: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-value str">"GET:"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
568
|
+
154: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
569
|
+
155: <span class="ruby-identifier">try_http</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span>,<span class="ruby-identifier">path</span>,<span class="ruby-identifier">head</span><span class="ruby-operator">|</span>
|
570
|
+
156: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">head</span>)
|
571
|
+
157: <span class="ruby-keyword kw">end</span>
|
572
|
+
158: <span class="ruby-identifier">res</span>
|
573
|
+
159: <span class="ruby-keyword kw">end</span>
|
574
|
+
</pre>
|
575
|
+
</div>
|
576
|
+
</div>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
<div id="method-M000042" class="method-detail">
|
580
|
+
<a name="M000042"></a>
|
581
|
+
|
582
|
+
<div class="method-heading">
|
583
|
+
<a href="#M000042" class="method-signature">
|
584
|
+
<span class="method-name">do_post</span><span class="method-args">(uri, header, content)</span>
|
585
|
+
</a>
|
586
|
+
</div>
|
587
|
+
|
588
|
+
<div class="method-description">
|
589
|
+
<p><a class="source-toggle" href="#"
|
590
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
591
|
+
<div class="method-source-code" id="M000042-source">
|
592
|
+
<pre>
|
593
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 142</span>
|
594
|
+
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>, <span class="ruby-identifier">content</span>)
|
595
|
+
143: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-value str">"POST:"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
596
|
+
144: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
597
|
+
145: <span class="ruby-identifier">try_http</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>, <span class="ruby-identifier">content</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span>,<span class="ruby-identifier">path</span>,<span class="ruby-identifier">head</span>,<span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
598
|
+
146: <span class="ruby-identifier">cont</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
599
|
+
147: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">cont</span>, <span class="ruby-identifier">head</span>)
|
600
|
+
148: <span class="ruby-keyword kw">end</span>
|
601
|
+
149: <span class="ruby-identifier">res</span>
|
602
|
+
150: <span class="ruby-keyword kw">end</span>
|
603
|
+
</pre>
|
604
|
+
</div>
|
605
|
+
</div>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
<div id="method-M000045" class="method-detail">
|
609
|
+
<a name="M000045"></a>
|
610
|
+
|
611
|
+
<div class="method-heading">
|
612
|
+
<a href="#M000045" class="method-signature">
|
613
|
+
<span class="method-name">path_with_authorized_query</span><span class="method-args">(uri)</span>
|
614
|
+
</a>
|
615
|
+
</div>
|
616
|
+
|
617
|
+
<div class="method-description">
|
618
|
+
<p><a class="source-toggle" href="#"
|
619
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
620
|
+
<div class="method-source-code" id="M000045-source">
|
621
|
+
<pre>
|
622
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 190</span>
|
623
|
+
190: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path_with_authorized_query</span>(<span class="ruby-identifier">uri</span>)
|
624
|
+
191: <span class="ruby-identifier">query</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>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-value str">""</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>)
|
625
|
+
192: <span class="ruby-identifier">query</span>[<span class="ruby-value str">"gsessionid"</span>] = [<span class="ruby-ivar">@session</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@session</span>
|
626
|
+
193: <span class="ruby-identifier">qs</span> = <span class="ruby-identifier">query</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{CGI.escape(k)}=#{CGI.escape(v[0])}"</span> <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"&"</span>)
|
627
|
+
194: <span class="ruby-identifier">qs</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#{uri.path}?#{qs}"</span>
|
628
|
+
195: <span class="ruby-keyword kw">end</span>
|
629
|
+
</pre>
|
630
|
+
</div>
|
631
|
+
</div>
|
632
|
+
</div>
|
633
|
+
|
634
|
+
<div id="method-M000044" class="method-detail">
|
635
|
+
<a name="M000044"></a>
|
636
|
+
|
637
|
+
<div class="method-heading">
|
638
|
+
<a href="#M000044" class="method-signature">
|
639
|
+
<span class="method-name">try_http</span><span class="method-args">(uri, header, *args) {|http, path_with_authorized_query(uri, header, args)| ...}</span>
|
640
|
+
</a>
|
641
|
+
</div>
|
642
|
+
|
643
|
+
<div class="method-description">
|
644
|
+
<p><a class="source-toggle" href="#"
|
645
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
646
|
+
<div class="method-source-code" id="M000044-source">
|
647
|
+
<pre>
|
648
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 161</span>
|
649
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">try_http</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
650
|
+
162: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
651
|
+
163: <span class="ruby-identifier">add_authorize_header</span>(<span class="ruby-identifier">header</span>)
|
652
|
+
164: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>, <span class="ruby-ivar">@@proxy_addr</span>, <span class="ruby-ivar">@@proxy_port</span>, <span class="ruby-ivar">@@proxy_user</span>, <span class="ruby-ivar">@@proxy_pass</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
|
653
|
+
165: <span class="ruby-identifier">header</span>[<span class="ruby-value str">"Cookie"</span>] = <span class="ruby-ivar">@cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cookie</span>
|
654
|
+
166: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">http</span>, <span class="ruby-identifier">path_with_authorized_query</span>(<span class="ruby-identifier">uri</span>), <span class="ruby-identifier">header</span>, <span class="ruby-identifier">args</span>)
|
655
|
+
167: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-identifier">res</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
656
|
+
168: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"302"</span>
|
657
|
+
169: <span class="ruby-identifier">ck</span> = <span class="ruby-identifier">sess</span> = <span class="ruby-keyword kw">nil</span>
|
658
|
+
170: <span class="ruby-identifier">ck</span> = <span class="ruby-identifier">res</span>[<span class="ruby-value str">"set-cookie"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"set-cookie"</span>)
|
659
|
+
171: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">res</span>[<span class="ruby-value str">"location"</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"location"</span>)
|
660
|
+
172: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
|
661
|
+
173: <span class="ruby-identifier">qr</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>)
|
662
|
+
174: <span class="ruby-identifier">sess</span> = <span class="ruby-identifier">qr</span>[<span class="ruby-value str">"gsessionid"</span>][<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qr</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"gsessionid"</span>)
|
663
|
+
175: <span class="ruby-keyword kw">end</span>
|
664
|
+
176: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ck</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">sess</span>
|
665
|
+
177: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"cookie: #{ck}, gsessionid:#{sess}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
666
|
+
178: <span class="ruby-identifier">header</span>[<span class="ruby-value str">"Cookie"</span>] = <span class="ruby-ivar">@cookie</span> = <span class="ruby-identifier">ck</span>
|
667
|
+
179: <span class="ruby-ivar">@session</span> = <span class="ruby-identifier">sess</span>
|
668
|
+
180: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">http</span>, <span class="ruby-identifier">path_with_authorized_query</span>(<span class="ruby-identifier">uri</span>), <span class="ruby-identifier">header</span>, <span class="ruby-identifier">args</span>)
|
669
|
+
181: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-identifier">res</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
670
|
+
182: <span class="ruby-keyword kw">else</span>
|
671
|
+
183: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">fatal</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>, <span class="ruby-value str">' '</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
672
|
+
184: <span class="ruby-keyword kw">end</span>
|
673
|
+
185: <span class="ruby-keyword kw">end</span>
|
674
|
+
186: <span class="ruby-keyword kw">end</span>
|
675
|
+
187: <span class="ruby-identifier">res</span>
|
676
|
+
188: <span class="ruby-keyword kw">end</span>
|
677
|
+
</pre>
|
678
|
+
</div>
|
679
|
+
</div>
|
680
|
+
</div>
|
681
|
+
|
682
|
+
|
683
|
+
</div>
|
684
|
+
|
685
|
+
|
686
|
+
</div>
|
687
|
+
|
688
|
+
|
689
|
+
<div id="validator-badges">
|
690
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
691
|
+
</div>
|
692
|
+
|
693
|
+
</body>
|
694
|
+
</html>
|