gcalapi 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/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
@@ -1,511 +1,801 @@
|
|
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::Event</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::Event</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/googlecalendar/event_rb.html">
|
59
|
-
lib/googlecalendar/event.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
|
-
<pre>
|
84
|
-
this class represents an event of a calendar.
|
85
|
-
</pre>
|
86
|
-
<h1>How to use this class</h1>
|
87
|
-
<ul>
|
88
|
-
<li>MAIL: your gmail account.
|
89
|
-
|
90
|
-
</li>
|
91
|
-
<li>PASS: password for MAIL.
|
92
|
-
|
93
|
-
</li>
|
94
|
-
<li>FEED: a calendar’s editable feed url.
|
95
|
-
|
96
|
-
<ol>
|
97
|
-
<li>click "Manage Calendars" in Google <a
|
98
|
-
href="Calendar.html">Calendar</a>.
|
99
|
-
|
100
|
-
</li>
|
101
|
-
<li>select a calendar you want to edit.
|
102
|
-
|
103
|
-
</li>
|
104
|
-
<li>copy private address of XML.
|
105
|
-
|
106
|
-
</li>
|
107
|
-
<li>change the address’s end into "/private/full". If your
|
108
|
-
calendar’s private XML address is
|
109
|
-
|
110
|
-
<pre>
|
111
|
-
"http://www.google.com/calendar/feeds/XXX@group.calendar.google.com/private-aaaaaa/basic",
|
112
|
-
</pre>
|
113
|
-
<p>
|
114
|
-
the editable feed url is
|
115
|
-
</p>
|
116
|
-
<pre>
|
117
|
-
"http://www.google.com/calendar/feeds/XXX@group.calendar.google.com/private/full".
|
118
|
-
</pre>
|
119
|
-
</li>
|
120
|
-
<li>for detail, See <a
|
121
|
-
href="http://code.google.com/apis/gdata/calendar.html#Visibility">code.google.com/apis/gdata/calendar.html#Visibility</a>.
|
122
|
-
|
123
|
-
</li>
|
124
|
-
</ol>
|
125
|
-
</li>
|
126
|
-
</ul>
|
127
|
-
<h2>create new events</h2>
|
128
|
-
<pre>
|
129
|
-
cal = Calendar.new(Service.new(MAIL, PASS), FEED)
|
130
|
-
event = cal.create_event
|
131
|
-
event.title = "event title"
|
132
|
-
event.desc = "event description"
|
133
|
-
event.where = "event location"
|
134
|
-
event.st = Time.mktime(2006, 9, 21, 01, 0, 0)
|
135
|
-
event.en = Time.mktime(2006, 9, 21, 03, 0, 0)
|
136
|
-
event.save!
|
137
|
-
</pre>
|
138
|
-
<h2>udpate existing events</h2>
|
139
|
-
<pre>
|
140
|
-
cal = Calendar.new(Service.new(MAIL, PASS), FEED)
|
141
|
-
event = cal.events[0]
|
142
|
-
event.title = "event title"
|
143
|
-
event.desc = "event description"
|
144
|
-
event.where = "event location"
|
145
|
-
event.st = Time.mktime(2006, 9, 21, 01, 0, 0)
|
146
|
-
event.en = Time.mktime(2006, 9, 21, 03, 0, 0)
|
147
|
-
event.save!
|
148
|
-
</pre>
|
149
|
-
<h2>delete events</h2>
|
150
|
-
<pre>
|
151
|
-
cal = Calendar.new(Service.new(MAIL, PASS), FEED)
|
152
|
-
event = cal.events[0]
|
153
|
-
event.destroy!
|
154
|
-
</pre>
|
155
|
-
<h2>create all day events.</h2>
|
156
|
-
<pre>
|
157
|
-
event = cal.create_event
|
158
|
-
event.title = "1 days event"
|
159
|
-
event.st = Time.mktime(2006, 9, 22)
|
160
|
-
event.en = Time.mktime(2006, 9, 23)
|
161
|
-
event.allday = true
|
162
|
-
event.save!
|
163
|
-
|
164
|
-
event = cal.create_event
|
165
|
-
event.title = "2 days event"
|
166
|
-
event.st = Time.mktime(2006, 9, 22)
|
167
|
-
event.en = Time.mktime(2006, 9, 24)
|
168
|
-
event.allday = true
|
169
|
-
event.save!
|
170
|
-
</pre>
|
171
|
-
<h1>TODO</h1>
|
172
|
-
<ul>
|
173
|
-
<li>this class doesn’t support recurring event.
|
174
|
-
|
175
|
-
</li>
|
176
|
-
</ul>
|
177
|
-
|
178
|
-
</div>
|
179
|
-
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div id="method-list">
|
184
|
-
<h3 class="section-bar">Methods</h3>
|
185
|
-
|
186
|
-
<div class="name-list">
|
187
|
-
<a href="#M000009">destroy</a>
|
188
|
-
<a href="#M000010">destroy!</a>
|
189
|
-
<a href="#M000006">load_xml</a>
|
190
|
-
<a href="#M000005">new</a>
|
191
|
-
<a href="#M000007">save</a>
|
192
|
-
<a href="#M000008">save!</a>
|
193
|
-
<a href="#M000011">to_s</a>
|
194
|
-
</div>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
</div>
|
198
|
-
|
199
|
-
|
200
|
-
<!-- if includes -->
|
201
|
-
|
202
|
-
<div id="section">
|
203
|
-
|
204
|
-
|
205
|
-
<div id="constants-list">
|
206
|
-
<h3 class="section-bar">Constants</h3>
|
207
|
-
|
208
|
-
<div class="name-list">
|
209
|
-
<table summary="Constants">
|
210
|
-
<tr class="top-aligned-row context-row">
|
211
|
-
<td class="context-item-name">ATTRIBUTES_MAP</td>
|
212
|
-
<td>=</td>
|
213
|
-
<td class="context-item-value">{
|
214
1
|
"title" => { "element" => "title"},
|
215
2
|
"desc" => { "element" => "content"},
|
216
3
|
"where" => { "element" => "gd:where", "attribute" => "valueString" },
|
217
4
|
"st" => { "element" => "gd:when", "attribute" => "startTime", "to_xml" => "time_to_str", "from_xml" => "str_to_time" },
|
218
5
|
"en" => { "element" => "gd:when", "attribute" => "endTime", "to_xml" => "time_to_str", "from_xml" => "str_to_time" }</td>
|
219
|
-
</tr>
|
220
|
-
<tr class="top-aligned-row context-row">
|
221
|
-
<td class="context-item-name">SKELTON</td>
|
222
|
-
<td>=</td>
|
223
|
-
<td class="context-item-value"><<XML
|
224
6
|
<?xml version='1.0' encoding='UTF-8'?>
|
225
7
|
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>
|
226
8
|
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'></category>
|
227
9
|
<title type='text'></title>
|
228
10
|
<content type='text'></content>
|
229
11
|
<gd:transparency value='http://schemas.google.com/g/2005#event.opaque'></gd:transparency>
|
230
12
|
<gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus>
|
231
13
|
</entry>
|
232
14
|
XML</td>
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
</
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
<
|
319
|
-
<
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
</
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
<pre>
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
</
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
<
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
</
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
<
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
</
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
<
|
436
|
-
<
|
437
|
-
|
438
|
-
<
|
439
|
-
|
440
|
-
</
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
</
|
459
|
-
<
|
460
|
-
|
461
|
-
|
462
|
-
<
|
463
|
-
<
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
</
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
<
|
489
|
-
<
|
490
|
-
<
|
491
|
-
|
492
|
-
</
|
493
|
-
|
494
|
-
|
495
|
-
<
|
496
|
-
|
497
|
-
</
|
498
|
-
|
499
|
-
|
500
|
-
<
|
501
|
-
<
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
</
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
<
|
521
|
-
|
522
|
-
</
|
523
|
-
|
524
|
-
</
|
15
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
16
|
+
<!DOCTYPE html
|
17
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
18
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
19
|
+
|
20
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
21
|
+
<head>
|
22
|
+
<title>Class: GoogleCalendar::Event</title>
|
23
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
24
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
25
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
26
|
+
<script type="text/javascript">
|
27
|
+
// <![CDATA[
|
28
|
+
|
29
|
+
function popupCode( url ) {
|
30
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
31
|
+
}
|
32
|
+
|
33
|
+
function toggleCode( id ) {
|
34
|
+
if ( document.getElementById )
|
35
|
+
elem = document.getElementById( id );
|
36
|
+
else if ( document.all )
|
37
|
+
elem = eval( "document.all." + id );
|
38
|
+
else
|
39
|
+
return false;
|
40
|
+
|
41
|
+
elemStyle = elem.style;
|
42
|
+
|
43
|
+
if ( elemStyle.display != "block" ) {
|
44
|
+
elemStyle.display = "block"
|
45
|
+
} else {
|
46
|
+
elemStyle.display = "none"
|
47
|
+
}
|
48
|
+
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
|
52
|
+
// Make codeblocks hidden by default
|
53
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
54
|
+
|
55
|
+
// ]]>
|
56
|
+
</script>
|
57
|
+
|
58
|
+
</head>
|
59
|
+
<body>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<div id="classHeader">
|
64
|
+
<table class="header-table">
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Class</strong></td>
|
67
|
+
<td class="class-name-in-header">GoogleCalendar::Event</td>
|
68
|
+
</tr>
|
69
|
+
<tr class="top-aligned-row">
|
70
|
+
<td><strong>In:</strong></td>
|
71
|
+
<td>
|
72
|
+
<a href="../../files/lib/googlecalendar/event_rb.html">
|
73
|
+
lib/googlecalendar/event.rb
|
74
|
+
</a>
|
75
|
+
<br />
|
76
|
+
</td>
|
77
|
+
</tr>
|
78
|
+
|
79
|
+
<tr class="top-aligned-row">
|
80
|
+
<td><strong>Parent:</strong></td>
|
81
|
+
<td>
|
82
|
+
Object
|
83
|
+
</td>
|
84
|
+
</tr>
|
85
|
+
</table>
|
86
|
+
</div>
|
87
|
+
<!-- banner header -->
|
88
|
+
|
89
|
+
<div id="bodyContent">
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<div id="contextContent">
|
94
|
+
|
95
|
+
<div id="description">
|
96
|
+
<h1>Summary</h1>
|
97
|
+
<pre>
|
98
|
+
this class represents an event of a calendar.
|
99
|
+
</pre>
|
100
|
+
<h1>How to use this class</h1>
|
101
|
+
<ul>
|
102
|
+
<li>MAIL: your gmail account.
|
103
|
+
|
104
|
+
</li>
|
105
|
+
<li>PASS: password for MAIL.
|
106
|
+
|
107
|
+
</li>
|
108
|
+
<li>FEED: a calendar‘s editable feed url.
|
109
|
+
|
110
|
+
<ol>
|
111
|
+
<li>your default calendar‘s feed url is defined in
|
112
|
+
Calendar::DEFAULT_CALENDAR_FEED. To <a href="Event.html#M000017">get</a>
|
113
|
+
other calendar‘s feed url, read below.
|
114
|
+
|
115
|
+
</li>
|
116
|
+
<li>click "Manage Calendars" in Google <a
|
117
|
+
href="Calendar.html">Calendar</a>.
|
118
|
+
|
119
|
+
</li>
|
120
|
+
<li>select a calendar you want to edit.
|
121
|
+
|
122
|
+
</li>
|
123
|
+
<li>copy private address of XML.
|
124
|
+
|
125
|
+
</li>
|
126
|
+
<li>change the address‘s end into "/private/full". If your
|
127
|
+
calendar‘s private XML address is
|
128
|
+
|
129
|
+
<pre>
|
130
|
+
"http://www.google.com/calendar/feeds/XXX@group.calendar.google.com/private-aaaaaa/basic",
|
131
|
+
</pre>
|
132
|
+
<p>
|
133
|
+
the editable feed url is
|
134
|
+
</p>
|
135
|
+
<pre>
|
136
|
+
"http://www.google.com/calendar/feeds/XXX@group.calendar.google.com/private/full".
|
137
|
+
</pre>
|
138
|
+
</li>
|
139
|
+
<li>for detail, See <a
|
140
|
+
href="http://code.google.com/apis/gdata/calendar.html#Visibility">code.google.com/apis/gdata/calendar.html#Visibility</a>.
|
141
|
+
|
142
|
+
</li>
|
143
|
+
</ol>
|
144
|
+
</li>
|
145
|
+
</ul>
|
146
|
+
<h2>create <a href="Event.html#M000010">new</a> events</h2>
|
147
|
+
<pre>
|
148
|
+
cal = Calendar.new(Service.new(MAIL, PASS), FEED)
|
149
|
+
event = cal.create_event
|
150
|
+
event.title = "event title"
|
151
|
+
event.desc = "event description"
|
152
|
+
event.where = "event location"
|
153
|
+
event.st = Time.mktime(2006, 9, 21, 01, 0, 0)
|
154
|
+
event.en = Time.mktime(2006, 9, 21, 03, 0, 0)
|
155
|
+
event.save!
|
156
|
+
</pre>
|
157
|
+
<h2>udpate existing events</h2>
|
158
|
+
<pre>
|
159
|
+
cal = Calendar.new(Service.new(MAIL, PASS), FEED)
|
160
|
+
event = cal.events[0]
|
161
|
+
event.title = "event title"
|
162
|
+
event.desc = "event description"
|
163
|
+
event.where = "event location"
|
164
|
+
event.st = Time.mktime(2006, 9, 21, 01, 0, 0)
|
165
|
+
event.en = Time.mktime(2006, 9, 21, 03, 0, 0)
|
166
|
+
event.save!
|
167
|
+
</pre>
|
168
|
+
<h2>delete events</h2>
|
169
|
+
<pre>
|
170
|
+
cal = Calendar.new(Service.new(MAIL, PASS), FEED)
|
171
|
+
event = cal.events[0]
|
172
|
+
event.destroy!
|
173
|
+
</pre>
|
174
|
+
<h2>create all day events.</h2>
|
175
|
+
<pre>
|
176
|
+
event = cal.create_event
|
177
|
+
event.title = "1 days event"
|
178
|
+
event.st = Time.mktime(2006, 9, 22)
|
179
|
+
event.en = Time.mktime(2006, 9, 23)
|
180
|
+
event.allday = true
|
181
|
+
event.save!
|
182
|
+
|
183
|
+
event = cal.create_event
|
184
|
+
event.title = "2 days event"
|
185
|
+
event.st = Time.mktime(2006, 9, 22)
|
186
|
+
event.en = Time.mktime(2006, 9, 24)
|
187
|
+
event.allday = true
|
188
|
+
event.save!
|
189
|
+
</pre>
|
190
|
+
<h2><a href="Event.html#M000017">get</a> existint event</h2>
|
191
|
+
<pre>
|
192
|
+
event = Event.get(FEED, Service.new(MAIL, PASS))
|
193
|
+
</pre>
|
194
|
+
<h1>TODO</h1>
|
195
|
+
<ul>
|
196
|
+
<li>this class doesn‘t support recurring event.
|
197
|
+
|
198
|
+
</li>
|
199
|
+
</ul>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div id="method-list">
|
207
|
+
<h3 class="section-bar">Methods</h3>
|
208
|
+
|
209
|
+
<div class="name-list">
|
210
|
+
<a href="#M000014">destroy</a>
|
211
|
+
<a href="#M000015">destroy!</a>
|
212
|
+
<a href="#M000018">do_without_exception</a>
|
213
|
+
<a href="#M000017">get</a>
|
214
|
+
<a href="#M000020">instance_to_xml</a>
|
215
|
+
<a href="#M000011">load_xml</a>
|
216
|
+
<a href="#M000010">new</a>
|
217
|
+
<a href="#M000012">save</a>
|
218
|
+
<a href="#M000013">save!</a>
|
219
|
+
<a href="#M000021">str_to_time</a>
|
220
|
+
<a href="#M000022">time_to_str</a>
|
221
|
+
<a href="#M000016">to_s</a>
|
222
|
+
<a href="#M000019">xml_to_instance</a>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
<!-- if includes -->
|
230
|
+
|
231
|
+
<div id="section">
|
232
|
+
|
233
|
+
|
234
|
+
<div id="constants-list">
|
235
|
+
<h3 class="section-bar">Constants</h3>
|
236
|
+
|
237
|
+
<div class="name-list">
|
238
|
+
<table summary="Constants">
|
239
|
+
<tr class="top-aligned-row context-row">
|
240
|
+
<td class="context-item-name">ATTRIBUTES_MAP</td>
|
241
|
+
<td>=</td>
|
242
|
+
<td class="context-item-value">{ "title" => { "element" => "title"}, "desc" => { "element" => "content"}, "where" => { "element" => "gd:where", "attribute" => "valueString" }, "st" => { "element" => "gd:when", "attribute" => "startTime", "to_xml" => "time_to_str", "from_xml" => "str_to_time" }, "en" => { "element" => "gd:when", "attribute" => "endTime", "to_xml" => "time_to_str", "from_xml" => "str_to_time" }</td>
|
243
|
+
</tr>
|
244
|
+
<tr class="top-aligned-row context-row">
|
245
|
+
<td class="context-item-name">SKELTON</td>
|
246
|
+
<td>=</td>
|
247
|
+
<td class="context-item-value"><<XML <?xml version='1.0' encoding='UTF-8'?> <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'></category> <title type='text'></title> <content type='text'></content> <gd:transparency value='http://schemas.google.com/g/2005#event.opaque'></gd:transparency> <gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus> </entry> XML</td>
|
248
|
+
</tr>
|
249
|
+
</table>
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<div id="attribute-list">
|
256
|
+
<h3 class="section-bar">Attributes</h3>
|
257
|
+
|
258
|
+
<div class="name-list">
|
259
|
+
<table>
|
260
|
+
<tr class="top-aligned-row context-row">
|
261
|
+
<td class="context-item-name">allday</td>
|
262
|
+
<td class="context-item-value"> [RW] </td>
|
263
|
+
<td class="context-item-desc"></td>
|
264
|
+
</tr>
|
265
|
+
<tr class="top-aligned-row context-row">
|
266
|
+
<td class="context-item-name">desc</td>
|
267
|
+
<td class="context-item-value"> [RW] </td>
|
268
|
+
<td class="context-item-desc"></td>
|
269
|
+
</tr>
|
270
|
+
<tr class="top-aligned-row context-row">
|
271
|
+
<td class="context-item-name">en</td>
|
272
|
+
<td class="context-item-value"> [RW] </td>
|
273
|
+
<td class="context-item-desc"></td>
|
274
|
+
</tr>
|
275
|
+
<tr class="top-aligned-row context-row">
|
276
|
+
<td class="context-item-name">feed</td>
|
277
|
+
<td class="context-item-value"> [RW] </td>
|
278
|
+
<td class="context-item-desc"></td>
|
279
|
+
</tr>
|
280
|
+
<tr class="top-aligned-row context-row">
|
281
|
+
<td class="context-item-name">srv</td>
|
282
|
+
<td class="context-item-value"> [RW] </td>
|
283
|
+
<td class="context-item-desc"></td>
|
284
|
+
</tr>
|
285
|
+
<tr class="top-aligned-row context-row">
|
286
|
+
<td class="context-item-name">st</td>
|
287
|
+
<td class="context-item-value"> [RW] </td>
|
288
|
+
<td class="context-item-desc"></td>
|
289
|
+
</tr>
|
290
|
+
<tr class="top-aligned-row context-row">
|
291
|
+
<td class="context-item-name">status</td>
|
292
|
+
<td class="context-item-value"> [RW] </td>
|
293
|
+
<td class="context-item-desc"></td>
|
294
|
+
</tr>
|
295
|
+
<tr class="top-aligned-row context-row">
|
296
|
+
<td class="context-item-name">title</td>
|
297
|
+
<td class="context-item-value"> [RW] </td>
|
298
|
+
<td class="context-item-desc"></td>
|
299
|
+
</tr>
|
300
|
+
<tr class="top-aligned-row context-row">
|
301
|
+
<td class="context-item-name">where</td>
|
302
|
+
<td class="context-item-value"> [RW] </td>
|
303
|
+
<td class="context-item-desc"></td>
|
304
|
+
</tr>
|
305
|
+
<tr class="top-aligned-row context-row">
|
306
|
+
<td class="context-item-name">xml</td>
|
307
|
+
<td class="context-item-value"> [RW] </td>
|
308
|
+
<td class="context-item-desc"></td>
|
309
|
+
</tr>
|
310
|
+
</table>
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<!-- if method_list -->
|
317
|
+
<div id="methods">
|
318
|
+
<h3 class="section-bar">Public Class methods</h3>
|
319
|
+
|
320
|
+
<div id="method-M000017" class="method-detail">
|
321
|
+
<a name="M000017"></a>
|
322
|
+
|
323
|
+
<div class="method-heading">
|
324
|
+
<a href="#M000017" class="method-signature">
|
325
|
+
<span class="method-name">get</span><span class="method-args">(feed, srv)</span>
|
326
|
+
</a>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
<div class="method-description">
|
330
|
+
<p>
|
331
|
+
<a href="Event.html#M000017">get</a> event from event feed
|
332
|
+
</p>
|
333
|
+
<p><a class="source-toggle" href="#"
|
334
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
335
|
+
<div class="method-source-code" id="M000017-source">
|
336
|
+
<pre>
|
337
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 168</span>
|
338
|
+
168: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">srv</span>)
|
339
|
+
169: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">srv</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">feed</span>)
|
340
|
+
170: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventGetFailed</span>, <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">body</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
341
|
+
171: <span class="ruby-identifier">evt</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>
|
342
|
+
172: <span class="ruby-identifier">evt</span>.<span class="ruby-identifier">srv</span> = <span class="ruby-identifier">srv</span>
|
343
|
+
173: <span class="ruby-identifier">evt</span>.<span class="ruby-identifier">load_xml</span>(<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">body</span>)
|
344
|
+
174: <span class="ruby-identifier">evt</span>
|
345
|
+
175: <span class="ruby-keyword kw">end</span>
|
346
|
+
</pre>
|
347
|
+
</div>
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
|
351
|
+
<div id="method-M000010" class="method-detail">
|
352
|
+
<a name="M000010"></a>
|
353
|
+
|
354
|
+
<div class="method-heading">
|
355
|
+
<a href="#M000010" class="method-signature">
|
356
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
357
|
+
</a>
|
358
|
+
</div>
|
359
|
+
|
360
|
+
<div class="method-description">
|
361
|
+
<p><a class="source-toggle" href="#"
|
362
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
363
|
+
<div class="method-source-code" id="M000010-source">
|
364
|
+
<pre>
|
365
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 108</span>
|
366
|
+
108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>()
|
367
|
+
109: <span class="ruby-ivar">@xml</span> = <span class="ruby-keyword kw">nil</span>
|
368
|
+
110: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">:new</span>
|
369
|
+
111: <span class="ruby-keyword kw">end</span>
|
370
|
+
</pre>
|
371
|
+
</div>
|
372
|
+
</div>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
376
|
+
|
377
|
+
<div id="method-M000014" class="method-detail">
|
378
|
+
<a name="M000014"></a>
|
379
|
+
|
380
|
+
<div class="method-heading">
|
381
|
+
<a href="#M000014" class="method-signature">
|
382
|
+
<span class="method-name">destroy</span><span class="method-args">()</span>
|
383
|
+
</a>
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div class="method-description">
|
387
|
+
<p>
|
388
|
+
same as <a href="Event.html#M000015">destroy!</a> If failed, this method
|
389
|
+
returns false.
|
390
|
+
</p>
|
391
|
+
<p><a class="source-toggle" href="#"
|
392
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
393
|
+
<div class="method-source-code" id="M000014-source">
|
394
|
+
<pre>
|
395
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 144</span>
|
396
|
+
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span>
|
397
|
+
145: <span class="ruby-identifier">do_without_exception</span>(<span class="ruby-identifier">:destroy!</span>)
|
398
|
+
146: <span class="ruby-keyword kw">end</span>
|
399
|
+
</pre>
|
400
|
+
</div>
|
401
|
+
</div>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<div id="method-M000015" class="method-detail">
|
405
|
+
<a name="M000015"></a>
|
406
|
+
|
407
|
+
<div class="method-heading">
|
408
|
+
<a href="#M000015" class="method-signature">
|
409
|
+
<span class="method-name">destroy!</span><span class="method-args">()</span>
|
410
|
+
</a>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div class="method-description">
|
414
|
+
<p>
|
415
|
+
delete this event from google calendar server. If failed, this method
|
416
|
+
throws an Exception.
|
417
|
+
</p>
|
418
|
+
<p><a class="source-toggle" href="#"
|
419
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
420
|
+
<div class="method-source-code" id="M000015-source">
|
421
|
+
<pre>
|
422
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 149</span>
|
423
|
+
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy!</span>
|
424
|
+
150: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
425
|
+
151: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:old</span>
|
426
|
+
152: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>)
|
427
|
+
153: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"Not Deleted"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
428
|
+
154: <span class="ruby-keyword kw">else</span>
|
429
|
+
155: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"Not Saved"</span>
|
430
|
+
156: <span class="ruby-keyword kw">end</span>
|
431
|
+
157: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">:deleted</span>
|
432
|
+
158: <span class="ruby-keyword kw">end</span>
|
433
|
+
</pre>
|
434
|
+
</div>
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
|
438
|
+
<div id="method-M000011" class="method-detail">
|
439
|
+
<a name="M000011"></a>
|
440
|
+
|
441
|
+
<div class="method-heading">
|
442
|
+
<a href="#M000011" class="method-signature">
|
443
|
+
<span class="method-name">load_xml</span><span class="method-args">(str)</span>
|
444
|
+
</a>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
<div class="method-description">
|
448
|
+
<p>
|
449
|
+
load xml into this instance
|
450
|
+
</p>
|
451
|
+
<p><a class="source-toggle" href="#"
|
452
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
453
|
+
<div class="method-source-code" id="M000011-source">
|
454
|
+
<pre>
|
455
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 114</span>
|
456
|
+
114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_xml</span>(<span class="ruby-identifier">str</span>)
|
457
|
+
115: <span class="ruby-ivar">@xml</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">str</span>.<span class="ruby-identifier">to_s</span>)
|
458
|
+
116: <span class="ruby-identifier">xml_to_instance</span>
|
459
|
+
117: <span class="ruby-keyword kw">self</span>
|
460
|
+
118: <span class="ruby-keyword kw">end</span>
|
461
|
+
</pre>
|
462
|
+
</div>
|
463
|
+
</div>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
<div id="method-M000012" class="method-detail">
|
467
|
+
<a name="M000012"></a>
|
468
|
+
|
469
|
+
<div class="method-heading">
|
470
|
+
<a href="#M000012" class="method-signature">
|
471
|
+
<span class="method-name">save</span><span class="method-args">()</span>
|
472
|
+
</a>
|
473
|
+
</div>
|
474
|
+
|
475
|
+
<div class="method-description">
|
476
|
+
<p>
|
477
|
+
same as <a href="Event.html#M000013">save!</a> If failed, this method
|
478
|
+
returns false.
|
479
|
+
</p>
|
480
|
+
<p><a class="source-toggle" href="#"
|
481
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
482
|
+
<div class="method-source-code" id="M000012-source">
|
483
|
+
<pre>
|
484
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 121</span>
|
485
|
+
121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
|
486
|
+
122: <span class="ruby-identifier">do_without_exception</span>(<span class="ruby-identifier">:save!</span>)
|
487
|
+
123: <span class="ruby-keyword kw">end</span>
|
488
|
+
</pre>
|
489
|
+
</div>
|
490
|
+
</div>
|
491
|
+
</div>
|
492
|
+
|
493
|
+
<div id="method-M000013" class="method-detail">
|
494
|
+
<a name="M000013"></a>
|
495
|
+
|
496
|
+
<div class="method-heading">
|
497
|
+
<a href="#M000013" class="method-signature">
|
498
|
+
<span class="method-name">save!</span><span class="method-args">()</span>
|
499
|
+
</a>
|
500
|
+
</div>
|
501
|
+
|
502
|
+
<div class="method-description">
|
503
|
+
<p>
|
504
|
+
<a href="Event.html#M000012">save</a> this event into google calendar
|
505
|
+
server. If failed, this method throws an Exception.
|
506
|
+
</p>
|
507
|
+
<p><a class="source-toggle" href="#"
|
508
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
509
|
+
<div class="method-source-code" id="M000013-source">
|
510
|
+
<pre>
|
511
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 126</span>
|
512
|
+
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save!</span>
|
513
|
+
127: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
514
|
+
128: <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span>
|
515
|
+
129: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:new</span>
|
516
|
+
130: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>)
|
517
|
+
131: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventInsertFailed</span>, <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">body</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"201"</span>
|
518
|
+
132: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:old</span>
|
519
|
+
133: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">update</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>)
|
520
|
+
134: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventUpdateFailed</span>, <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">body</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
521
|
+
135: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:deleted</span>
|
522
|
+
136: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"already deleted"</span>
|
523
|
+
137: <span class="ruby-keyword kw">else</span>
|
524
|
+
138: <span class="ruby-identifier">raise</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-value str">"invalid inner status"</span>
|
525
|
+
139: <span class="ruby-keyword kw">end</span>
|
526
|
+
140: <span class="ruby-identifier">load_xml</span>(<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">body</span>)
|
527
|
+
141: <span class="ruby-keyword kw">end</span>
|
528
|
+
</pre>
|
529
|
+
</div>
|
530
|
+
</div>
|
531
|
+
</div>
|
532
|
+
|
533
|
+
<div id="method-M000016" class="method-detail">
|
534
|
+
<a name="M000016"></a>
|
535
|
+
|
536
|
+
<div class="method-heading">
|
537
|
+
<a href="#M000016" class="method-signature">
|
538
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
539
|
+
</a>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
<div class="method-description">
|
543
|
+
<p>
|
544
|
+
retuns this event‘s xml.
|
545
|
+
</p>
|
546
|
+
<p><a class="source-toggle" href="#"
|
547
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
548
|
+
<div class="method-source-code" id="M000016-source">
|
549
|
+
<pre>
|
550
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 161</span>
|
551
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
552
|
+
162: <span class="ruby-ivar">@xml</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SKELTON</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:new</span>
|
553
|
+
163: <span class="ruby-identifier">instance_to_xml</span>
|
554
|
+
164: <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">to_s</span>
|
555
|
+
165: <span class="ruby-keyword kw">end</span>
|
556
|
+
</pre>
|
557
|
+
</div>
|
558
|
+
</div>
|
559
|
+
</div>
|
560
|
+
|
561
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
562
|
+
|
563
|
+
<div id="method-M000018" class="method-detail">
|
564
|
+
<a name="M000018"></a>
|
565
|
+
|
566
|
+
<div class="method-heading">
|
567
|
+
<a href="#M000018" class="method-signature">
|
568
|
+
<span class="method-name">do_without_exception</span><span class="method-args">(method)</span>
|
569
|
+
</a>
|
570
|
+
</div>
|
571
|
+
|
572
|
+
<div class="method-description">
|
573
|
+
<p><a class="source-toggle" href="#"
|
574
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
575
|
+
<div class="method-source-code" id="M000018-source">
|
576
|
+
<pre>
|
577
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 178</span>
|
578
|
+
178: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_without_exception</span>(<span class="ruby-identifier">method</span>)
|
579
|
+
179: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">true</span>
|
580
|
+
180: <span class="ruby-keyword kw">begin</span>
|
581
|
+
181: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">method</span>)
|
582
|
+
182: <span class="ruby-keyword kw">rescue</span>
|
583
|
+
183: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">false</span>
|
584
|
+
184: <span class="ruby-keyword kw">end</span>
|
585
|
+
185: <span class="ruby-identifier">ret</span>
|
586
|
+
186: <span class="ruby-keyword kw">end</span>
|
587
|
+
</pre>
|
588
|
+
</div>
|
589
|
+
</div>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
<div id="method-M000020" class="method-detail">
|
593
|
+
<a name="M000020"></a>
|
594
|
+
|
595
|
+
<div class="method-heading">
|
596
|
+
<a href="#M000020" class="method-signature">
|
597
|
+
<span class="method-name">instance_to_xml</span><span class="method-args">()</span>
|
598
|
+
</a>
|
599
|
+
</div>
|
600
|
+
|
601
|
+
<div class="method-description">
|
602
|
+
<p>
|
603
|
+
set attributes of an instance into xml
|
604
|
+
</p>
|
605
|
+
<p><a class="source-toggle" href="#"
|
606
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
607
|
+
<div class="method-source-code" id="M000020-source">
|
608
|
+
<pre>
|
609
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 206</span>
|
610
|
+
206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instance_to_xml</span>
|
611
|
+
207: <span class="ruby-constant">ATTRIBUTES_MAP</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
612
|
+
208: <span class="ruby-identifier">elem</span> = <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"element"</span>]]
|
613
|
+
209: <span class="ruby-identifier">elem</span> = <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"element"</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">nil?</span>
|
614
|
+
210: <span class="ruby-identifier">val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">name</span>)
|
615
|
+
211: <span class="ruby-identifier">val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"to_xml"</span>], <span class="ruby-identifier">val</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">"to_xml"</span>)
|
616
|
+
212: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">"attribute"</span>)
|
617
|
+
213: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"attribute"</span>]] = <span class="ruby-identifier">val</span>
|
618
|
+
214: <span class="ruby-keyword kw">else</span>
|
619
|
+
215: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">val</span>
|
620
|
+
216: <span class="ruby-keyword kw">end</span>
|
621
|
+
217: <span class="ruby-keyword kw">end</span>
|
622
|
+
218: <span class="ruby-keyword kw">end</span>
|
623
|
+
</pre>
|
624
|
+
</div>
|
625
|
+
</div>
|
626
|
+
</div>
|
627
|
+
|
628
|
+
<div id="method-M000021" class="method-detail">
|
629
|
+
<a name="M000021"></a>
|
630
|
+
|
631
|
+
<div class="method-heading">
|
632
|
+
<a href="#M000021" class="method-signature">
|
633
|
+
<span class="method-name">str_to_time</span><span class="method-args">(st)</span>
|
634
|
+
</a>
|
635
|
+
</div>
|
636
|
+
|
637
|
+
<div class="method-description">
|
638
|
+
<h2>Allday <a href="Event.html">Event</a> Bugs</h2>
|
639
|
+
<p>
|
640
|
+
When creating all day event, the format of gd:when startTime and gd:when
|
641
|
+
endTime must be "yyyy-mm-ddZ" which represents UTC. otherwise the
|
642
|
+
wrong data returns. below is the test result. I used 3 countries’
|
643
|
+
calendar. US, UK, and Japan. And in each calendar, I created all day events
|
644
|
+
in three types of date format. A) yyyy-mm-dd B) yyyy-mm-ddZ C)
|
645
|
+
yyyy-mm-dd+(-)hh:mm only type B format always returns the correct data.
|
646
|
+
</p>
|
647
|
+
<p>
|
648
|
+
1) US calendar (all type is OK) A: input start => 2006-09-18, end =>
|
649
|
+
2006-09-19
|
650
|
+
</p>
|
651
|
+
<pre>
|
652
|
+
output start => 2006-09-18, end => 2006-09-19
|
653
|
+
</pre>
|
654
|
+
<p>
|
655
|
+
B: input start => 2006-09-18Z,end => 2006-09-19Z
|
656
|
+
</p>
|
657
|
+
<pre>
|
658
|
+
output start => 2006-09-18, end => 2006-09-19
|
659
|
+
</pre>
|
660
|
+
<p>
|
661
|
+
C: input start => 2006-09-18-08:00,end => 2006-09-19-08:00
|
662
|
+
</p>
|
663
|
+
<pre>
|
664
|
+
output start => 2006-09-18, end => 2006-09-19
|
665
|
+
</pre>
|
666
|
+
<p>
|
667
|
+
2) UK calenar (A returns wrong data. B and C is OK) A: input start =>
|
668
|
+
2006-09-18, end => 2006-09-19
|
669
|
+
</p>
|
670
|
+
<pre>
|
671
|
+
output start => 2006-09-17, end => 2006-09-18
|
672
|
+
</pre>
|
673
|
+
<p>
|
674
|
+
B: input start => 2006-09-18Z,end => 2006-09-19Z
|
675
|
+
</p>
|
676
|
+
<pre>
|
677
|
+
output start => 2006-09-18, end => 2006-09-19
|
678
|
+
</pre>
|
679
|
+
<p>
|
680
|
+
C: input start => 2006-09-18-00:00,end => 2006-09-19-00:00
|
681
|
+
</p>
|
682
|
+
<pre>
|
683
|
+
output start => 2006-09-18, end => 2006-09-19
|
684
|
+
</pre>
|
685
|
+
<p>
|
686
|
+
3) Japan calendar (A and C returns wrong data. only B is OK) A: input start
|
687
|
+
=> 2006-09-18, end => 2006-09-19
|
688
|
+
</p>
|
689
|
+
<pre>
|
690
|
+
output start => 2006-09-17, end => 2006-09-18
|
691
|
+
</pre>
|
692
|
+
<p>
|
693
|
+
B: input start => 2006-09-18Z,end => 2006-09-19Z
|
694
|
+
</p>
|
695
|
+
<pre>
|
696
|
+
output start => 2006-09-18, end => 2006-09-19
|
697
|
+
</pre>
|
698
|
+
<p>
|
699
|
+
C: input start => 2006-09-18+09:00,end => 2006-09-19+09:00
|
700
|
+
</p>
|
701
|
+
<pre>
|
702
|
+
output start => 2006-09-17, end => 2006-09-18
|
703
|
+
</pre>
|
704
|
+
<p>
|
705
|
+
convert String to Time
|
706
|
+
</p>
|
707
|
+
<p><a class="source-toggle" href="#"
|
708
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
709
|
+
<div class="method-source-code" id="M000021-source">
|
710
|
+
<pre>
|
711
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 261</span>
|
712
|
+
261: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">str_to_time</span>(<span class="ruby-identifier">st</span>)
|
713
|
+
262: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
714
|
+
263: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">st</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Time</span> <span class="ruby-keyword kw">then</span>
|
715
|
+
264: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">st</span>
|
716
|
+
265: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">st</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span> <span class="ruby-keyword kw">then</span>
|
717
|
+
266: <span class="ruby-keyword kw">begin</span>
|
718
|
+
267: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">allday</span> = <span class="ruby-keyword kw">false</span>
|
719
|
+
268: <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">iso8601</span>(<span class="ruby-identifier">st</span>)
|
720
|
+
269: <span class="ruby-keyword kw">rescue</span>
|
721
|
+
270: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">allday</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">st</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\d{4}-\d{2}-\d{2}/</span> <span class="ruby-comment cmt"># yyyy-mm-dd</span>
|
722
|
+
271: <span class="ruby-identifier">ret</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">st</span>)
|
723
|
+
272: <span class="ruby-keyword kw">end</span>
|
724
|
+
273: <span class="ruby-keyword kw">end</span>
|
725
|
+
274: <span class="ruby-identifier">ret</span>
|
726
|
+
275: <span class="ruby-keyword kw">end</span>
|
727
|
+
</pre>
|
728
|
+
</div>
|
729
|
+
</div>
|
730
|
+
</div>
|
731
|
+
|
732
|
+
<div id="method-M000022" class="method-detail">
|
733
|
+
<a name="M000022"></a>
|
734
|
+
|
735
|
+
<div class="method-heading">
|
736
|
+
<a href="#M000022" class="method-signature">
|
737
|
+
<span class="method-name">time_to_str</span><span class="method-args">(dt)</span>
|
738
|
+
</a>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
<div class="method-description">
|
742
|
+
<p>
|
743
|
+
returns string represents date or datetime
|
744
|
+
</p>
|
745
|
+
<p><a class="source-toggle" href="#"
|
746
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
747
|
+
<div class="method-source-code" id="M000022-source">
|
748
|
+
<pre>
|
749
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 278</span>
|
750
|
+
278: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time_to_str</span>(<span class="ruby-identifier">dt</span>)
|
751
|
+
279: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
752
|
+
280: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dt</span>.<span class="ruby-identifier">nil?</span>
|
753
|
+
281: <span class="ruby-identifier">ret</span> = <span class="ruby-value str">""</span>
|
754
|
+
282: <span class="ruby-keyword kw">else</span>
|
755
|
+
283: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">dt</span>.<span class="ruby-identifier">iso8601</span>
|
756
|
+
284: <span class="ruby-identifier">ret</span>[<span class="ruby-value">10</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] = <span class="ruby-value str">"Z"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">allday</span> <span class="ruby-comment cmt"># yyyy-mm-ddZ</span>
|
757
|
+
285: <span class="ruby-keyword kw">end</span>
|
758
|
+
286: <span class="ruby-identifier">ret</span>
|
759
|
+
287: <span class="ruby-keyword kw">end</span>
|
760
|
+
</pre>
|
761
|
+
</div>
|
762
|
+
</div>
|
763
|
+
</div>
|
764
|
+
|
765
|
+
<div id="method-M000019" class="method-detail">
|
766
|
+
<a name="M000019"></a>
|
767
|
+
|
768
|
+
<div class="method-heading">
|
769
|
+
<a href="#M000019" class="method-signature">
|
770
|
+
<span class="method-name">xml_to_instance</span><span class="method-args">()</span>
|
771
|
+
</a>
|
772
|
+
</div>
|
773
|
+
|
774
|
+
<div class="method-description">
|
775
|
+
<p>
|
776
|
+
set xml data to attributes of an instance
|
777
|
+
</p>
|
778
|
+
<p><a class="source-toggle" href="#"
|
779
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
780
|
+
<div class="method-source-code" id="M000019-source">
|
781
|
+
<pre>
|
782
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 189</span>
|
783
|
+
189: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xml_to_instance</span>
|
784
|
+
190: <span class="ruby-constant">ATTRIBUTES_MAP</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
|
785
|
+
191: <span class="ruby-identifier">elem</span> = <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"element"</span>]]
|
786
|
+
192: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">nil?</span>
|
787
|
+
193: <span class="ruby-identifier">val</span> = (<span class="ruby-identifier">hash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">"attribute"</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"attribute"</span>]] <span class="ruby-operator">:</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">text</span>)
|
788
|
+
194: <span class="ruby-identifier">val</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">"from_xml"</span>], <span class="ruby-identifier">val</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">"from_xml"</span>)
|
789
|
+
195: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">name</span><span class="ruby-operator">+</span><span class="ruby-value str">"="</span>, <span class="ruby-identifier">val</span>)
|
790
|
+
196: <span class="ruby-keyword kw">end</span>
|
791
|
+
197: <span class="ruby-keyword kw">end</span>
|
792
|
+
198: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">:old</span>
|
793
|
+
199:
|
794
|
+
200: <span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span>(<span class="ruby-value str">"link"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">link</span><span class="ruby-operator">|</span>
|
795
|
+
201: <span class="ruby-ivar">@feed</span> = <span class="ruby-identifier">link</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"href"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">link</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"rel"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"edit"</span>
|
796
|
+
202: <span class="ruby-keyword kw">end</span>
|
797
|
+
203: <span class="ruby-keyword kw">end</span>
|
798
|
+
</pre>
|
799
|
+
</div>
|
800
|
+
</div>
|
801
|
+
</div>
|
802
|
+
|
803
|
+
|
804
|
+
</div>
|
805
|
+
|
806
|
+
|
807
|
+
</div>
|
808
|
+
|
809
|
+
|
810
|
+
<div id="validator-badges">
|
811
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
812
|
+
</div>
|
813
|
+
|
814
|
+
</body>
|
525
815
|
</html>
|