gcalapi 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +13 -0
- data/Rakefile +82 -0
- data/VERSION +1 -0
- data/example/mail2gcal.rb +101 -0
- data/example/ol2gcal.rb +55 -0
- data/html/classes/GoogleCalendar.html +281 -0
- data/html/classes/GoogleCalendar/AuthenticationFailed.html +111 -0
- data/html/classes/GoogleCalendar/Calendar.html +204 -0
- data/html/classes/GoogleCalendar/Event.html +511 -0
- data/html/classes/GoogleCalendar/EventDeleteFailed.html +111 -0
- data/html/classes/GoogleCalendar/EventInsertFailed.html +111 -0
- data/html/classes/GoogleCalendar/EventUpdateFailed.html +111 -0
- data/html/classes/GoogleCalendar/InvalidCalendarURL.html +111 -0
- data/html/classes/GoogleCalendar/Service.html +472 -0
- data/html/created.rid +1 -0
- data/html/files/README.html +117 -0
- data/html/files/lib/googlecalendar/calendar_rb.html +110 -0
- data/html/files/lib/googlecalendar/event_rb.html +110 -0
- data/html/files/lib/googlecalendar/service_rb.html +114 -0
- data/html/fr_class_index.html +35 -0
- data/html/fr_file_index.html +30 -0
- data/html/fr_method_index.html +49 -0
- data/html/index.html +24 -0
- data/html/rdoc-style.css +208 -0
- data/lib/googlecalendar/calendar.rb +117 -0
- data/lib/googlecalendar/event.rb +283 -0
- data/lib/googlecalendar/service.rb +193 -0
- data/test/00_service_test.rb +169 -0
- data/test/01_calendar_test.rb +52 -0
- data/test/02_event_test.rb +60 -0
- data/test/all.sh +2 -0
- data/test/base_unit.rb +54 -0
- data/test/each.sh +2 -0
- metadata +85 -0
@@ -0,0 +1,111 @@
|
|
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::AuthenticationFailed</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::AuthenticationFailed</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/googlecalendar/service_rb.html">
|
59
|
+
lib/googlecalendar/service.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
|
+
StandardError
|
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
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
<!-- if includes -->
|
90
|
+
|
91
|
+
<div id="section">
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<!-- if method_list -->
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
<div id="validator-badges">
|
107
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</body>
|
111
|
+
</html>
|
@@ -0,0 +1,204 @@
|
|
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::Calendar</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::Calendar</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/googlecalendar/calendar_rb.html">
|
59
|
+
lib/googlecalendar/calendar.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 User's Calendar.
|
85
|
+
</pre>
|
86
|
+
<h1>How to get this class</h1>
|
87
|
+
<ul>
|
88
|
+
<li>get calendar list
|
89
|
+
|
90
|
+
<pre>
|
91
|
+
srv = GoogleCalendar::Service.new(MAIL, PASS)
|
92
|
+
cal_list = srv.calendars
|
93
|
+
|
94
|
+
cal_list is a hash of user's calendars.
|
95
|
+
key: a calendar's editable feed url.
|
96
|
+
value: calendar object.
|
97
|
+
</pre>
|
98
|
+
</li>
|
99
|
+
<li>create an instance from calendar’s feed url
|
100
|
+
|
101
|
+
<pre>
|
102
|
+
srv = GoogleCalendar::Service.new(MAIL, PASS)
|
103
|
+
cal = Calendar.new(srv, FEED)
|
104
|
+
</pre>
|
105
|
+
</li>
|
106
|
+
</ul>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div id="method-list">
|
114
|
+
<h3 class="section-bar">Methods</h3>
|
115
|
+
|
116
|
+
<div class="name-list">
|
117
|
+
<a href="#M000012">calendars</a>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<!-- if includes -->
|
125
|
+
|
126
|
+
<div id="section">
|
127
|
+
|
128
|
+
|
129
|
+
<div id="constants-list">
|
130
|
+
<h3 class="section-bar">Constants</h3>
|
131
|
+
|
132
|
+
<div class="name-list">
|
133
|
+
<table summary="Constants">
|
134
|
+
<tr class="top-aligned-row context-row">
|
135
|
+
<td class="context-item-name">ATTRIBUTES</td>
|
136
|
+
<td>=</td>
|
137
|
+
<td class="context-item-value">{ "updated" => ["updated"], "title" => ["title"], "subtitle" => ["subtitle"], "name" => ["author/name"], "email" => ["author/email"], "timezone" => ["gCal:timezone", "value"], "where" => ["gd:where", "valueString"]}.each do |key, val| module_eval( "def #{key}; self.source.root.elements[\"#{val[0]}\"]." + (val.length == 1 ? "text" : "attributes[\"#{val[1]}\"]") + "; end"</td>
|
138
|
+
<td width="3em"> </td>
|
139
|
+
<td class="context-item-desc">
|
140
|
+
defines calendar’s readonly attributes
|
141
|
+
|
142
|
+
</td>
|
143
|
+
</tr>
|
144
|
+
</table>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<!-- if method_list -->
|
154
|
+
<div id="methods">
|
155
|
+
<h3 class="section-bar">Public Class methods</h3>
|
156
|
+
|
157
|
+
<div id="method-M000012" class="method-detail">
|
158
|
+
<a name="M000012"></a>
|
159
|
+
|
160
|
+
<div class="method-heading">
|
161
|
+
<a href="#M000012" class="method-signature">
|
162
|
+
<span class="method-name">calendars</span><span class="method-args">(srv)</span>
|
163
|
+
</a>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div class="method-description">
|
167
|
+
<p>
|
168
|
+
get user’s calendar list.
|
169
|
+
</p>
|
170
|
+
<p><a class="source-toggle" href="#"
|
171
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
172
|
+
<div class="method-source-code" id="M000012-source">
|
173
|
+
<pre>
|
174
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 30</span>
|
175
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">calendars</span>(<span class="ruby-identifier">srv</span>)
|
176
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">srv</span>.<span class="ruby-identifier">calendar_list</span>
|
177
|
+
<span class="ruby-identifier">list</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">ret</span>.<span class="ruby-identifier">body</span>)
|
178
|
+
<span class="ruby-identifier">h</span> = {}
|
179
|
+
<span class="ruby-identifier">list</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span>(<span class="ruby-value str">"entry/link"</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
180
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"rel"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"alternate"</span>
|
181
|
+
<span class="ruby-identifier">feed</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"href"</span>]
|
182
|
+
<span class="ruby-identifier">h</span>[<span class="ruby-identifier">feed</span>] = <span class="ruby-constant">Calendar</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">srv</span>, <span class="ruby-identifier">feed</span>)
|
183
|
+
<span class="ruby-keyword kw">end</span>
|
184
|
+
<span class="ruby-keyword kw">end</span>
|
185
|
+
<span class="ruby-identifier">h</span>
|
186
|
+
<span class="ruby-keyword kw">end</span>
|
187
|
+
</pre>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
|
193
|
+
</div>
|
194
|
+
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
<div id="validator-badges">
|
200
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
</body>
|
204
|
+
</html>
|
@@ -0,0 +1,511 @@
|
|
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
|
"title" => { "element" => "title"},
|
1
215
|
"desc" => { "element" => "content"},
|
2
216
|
"where" => { "element" => "gd:where", "attribute" => "valueString" },
|
3
217
|
"st" => { "element" => "gd:when", "attribute" => "startTime", "to_xml" => "time_to_str", "from_xml" => "str_to_time" },
|
4
218
|
"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
|
5
224
|
<?xml version='1.0' encoding='UTF-8'?>
|
6
225
|
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>
|
7
226
|
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'></category>
|
8
227
|
<title type='text'></title>
|
9
228
|
<content type='text'></content>
|
10
229
|
<gd:transparency value='http://schemas.google.com/g/2005#event.opaque'></gd:transparency>
|
11
230
|
<gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus>
|
12
231
|
</entry>
|
13
232
|
XML</td>
|
233
|
+
</tr>
|
234
|
+
</table>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<div id="attribute-list">
|
241
|
+
<h3 class="section-bar">Attributes</h3>
|
242
|
+
|
243
|
+
<div class="name-list">
|
244
|
+
<table>
|
245
|
+
<tr class="top-aligned-row context-row">
|
246
|
+
<td class="context-item-name">allday</td>
|
247
|
+
<td class="context-item-value"> [RW] </td>
|
248
|
+
<td class="context-item-desc"></td>
|
249
|
+
</tr>
|
250
|
+
<tr class="top-aligned-row context-row">
|
251
|
+
<td class="context-item-name">desc</td>
|
252
|
+
<td class="context-item-value"> [RW] </td>
|
253
|
+
<td class="context-item-desc"></td>
|
254
|
+
</tr>
|
255
|
+
<tr class="top-aligned-row context-row">
|
256
|
+
<td class="context-item-name">en</td>
|
257
|
+
<td class="context-item-value"> [RW] </td>
|
258
|
+
<td class="context-item-desc"></td>
|
259
|
+
</tr>
|
260
|
+
<tr class="top-aligned-row context-row">
|
261
|
+
<td class="context-item-name">feed</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">srv</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">st</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">status</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">title</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">where</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">xml</td>
|
292
|
+
<td class="context-item-value"> [RW] </td>
|
293
|
+
<td class="context-item-desc"></td>
|
294
|
+
</tr>
|
295
|
+
</table>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<!-- if method_list -->
|
302
|
+
<div id="methods">
|
303
|
+
<h3 class="section-bar">Public Class methods</h3>
|
304
|
+
|
305
|
+
<div id="method-M000005" class="method-detail">
|
306
|
+
<a name="M000005"></a>
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<a href="#M000005" class="method-signature">
|
310
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
311
|
+
</a>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div class="method-description">
|
315
|
+
<p><a class="source-toggle" href="#"
|
316
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
317
|
+
<div class="method-source-code" id="M000005-source">
|
318
|
+
<pre>
|
319
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 101</span>
|
320
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>()
|
321
|
+
<span class="ruby-ivar">@xml</span> = <span class="ruby-keyword kw">nil</span>
|
322
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">:new</span>
|
323
|
+
<span class="ruby-keyword kw">end</span>
|
324
|
+
</pre>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
330
|
+
|
331
|
+
<div id="method-M000009" class="method-detail">
|
332
|
+
<a name="M000009"></a>
|
333
|
+
|
334
|
+
<div class="method-heading">
|
335
|
+
<a href="#M000009" class="method-signature">
|
336
|
+
<span class="method-name">destroy</span><span class="method-args">()</span>
|
337
|
+
</a>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
<div class="method-description">
|
341
|
+
<p>
|
342
|
+
same as destroy! If failed, this method returns false.
|
343
|
+
</p>
|
344
|
+
<p><a class="source-toggle" href="#"
|
345
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
346
|
+
<div class="method-source-code" id="M000009-source">
|
347
|
+
<pre>
|
348
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 137</span>
|
349
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span>
|
350
|
+
<span class="ruby-identifier">do_without_exception</span>(<span class="ruby-identifier">:destroy!</span>)
|
351
|
+
<span class="ruby-keyword kw">end</span>
|
352
|
+
</pre>
|
353
|
+
</div>
|
354
|
+
</div>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div id="method-M000010" class="method-detail">
|
358
|
+
<a name="M000010"></a>
|
359
|
+
|
360
|
+
<div class="method-heading">
|
361
|
+
<a href="#M000010" class="method-signature">
|
362
|
+
<span class="method-name">destroy!</span><span class="method-args">()</span>
|
363
|
+
</a>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
<div class="method-description">
|
367
|
+
<p>
|
368
|
+
delete this event from google calendar server. If failed, this method
|
369
|
+
throws an Exception.
|
370
|
+
</p>
|
371
|
+
<p><a class="source-toggle" href="#"
|
372
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
373
|
+
<div class="method-source-code" id="M000010-source">
|
374
|
+
<pre>
|
375
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 142</span>
|
376
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy!</span>
|
377
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
378
|
+
<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>
|
379
|
+
<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>)
|
380
|
+
<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>
|
381
|
+
<span class="ruby-keyword kw">else</span>
|
382
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"Not Saved"</span>
|
383
|
+
<span class="ruby-keyword kw">end</span>
|
384
|
+
<span class="ruby-identifier">status</span> = <span class="ruby-identifier">:deleted</span>
|
385
|
+
<span class="ruby-keyword kw">end</span>
|
386
|
+
</pre>
|
387
|
+
</div>
|
388
|
+
</div>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
<div id="method-M000006" class="method-detail">
|
392
|
+
<a name="M000006"></a>
|
393
|
+
|
394
|
+
<div class="method-heading">
|
395
|
+
<a href="#M000006" class="method-signature">
|
396
|
+
<span class="method-name">load_xml</span><span class="method-args">(str)</span>
|
397
|
+
</a>
|
398
|
+
</div>
|
399
|
+
|
400
|
+
<div class="method-description">
|
401
|
+
<p>
|
402
|
+
load xml into this instance
|
403
|
+
</p>
|
404
|
+
<p><a class="source-toggle" href="#"
|
405
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
406
|
+
<div class="method-source-code" id="M000006-source">
|
407
|
+
<pre>
|
408
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 107</span>
|
409
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_xml</span>(<span class="ruby-identifier">str</span>)
|
410
|
+
<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>)
|
411
|
+
<span class="ruby-identifier">xml_to_instance</span>
|
412
|
+
<span class="ruby-keyword kw">self</span>
|
413
|
+
<span class="ruby-keyword kw">end</span>
|
414
|
+
</pre>
|
415
|
+
</div>
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
|
419
|
+
<div id="method-M000007" class="method-detail">
|
420
|
+
<a name="M000007"></a>
|
421
|
+
|
422
|
+
<div class="method-heading">
|
423
|
+
<a href="#M000007" class="method-signature">
|
424
|
+
<span class="method-name">save</span><span class="method-args">()</span>
|
425
|
+
</a>
|
426
|
+
</div>
|
427
|
+
|
428
|
+
<div class="method-description">
|
429
|
+
<p>
|
430
|
+
same as save! If failed, this method returns false.
|
431
|
+
</p>
|
432
|
+
<p><a class="source-toggle" href="#"
|
433
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
434
|
+
<div class="method-source-code" id="M000007-source">
|
435
|
+
<pre>
|
436
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 114</span>
|
437
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
|
438
|
+
<span class="ruby-identifier">do_without_exception</span>(<span class="ruby-identifier">:save!</span>)
|
439
|
+
<span class="ruby-keyword kw">end</span>
|
440
|
+
</pre>
|
441
|
+
</div>
|
442
|
+
</div>
|
443
|
+
</div>
|
444
|
+
|
445
|
+
<div id="method-M000008" class="method-detail">
|
446
|
+
<a name="M000008"></a>
|
447
|
+
|
448
|
+
<div class="method-heading">
|
449
|
+
<a href="#M000008" class="method-signature">
|
450
|
+
<span class="method-name">save!</span><span class="method-args">()</span>
|
451
|
+
</a>
|
452
|
+
</div>
|
453
|
+
|
454
|
+
<div class="method-description">
|
455
|
+
<p>
|
456
|
+
save this event into google calendar server. If failed, this method throws
|
457
|
+
an Exception.
|
458
|
+
</p>
|
459
|
+
<p><a class="source-toggle" href="#"
|
460
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
461
|
+
<div class="method-source-code" id="M000008-source">
|
462
|
+
<pre>
|
463
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 119</span>
|
464
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save!</span>
|
465
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
466
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span>
|
467
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:new</span>
|
468
|
+
<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>)
|
469
|
+
<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>
|
470
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:old</span>
|
471
|
+
<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>)
|
472
|
+
<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>
|
473
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:deleted</span>
|
474
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"already deleted"</span>
|
475
|
+
<span class="ruby-keyword kw">else</span>
|
476
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-value str">"invalid inner status"</span>
|
477
|
+
<span class="ruby-keyword kw">end</span>
|
478
|
+
<span class="ruby-identifier">load_xml</span>(<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">body</span>)
|
479
|
+
<span class="ruby-keyword kw">end</span>
|
480
|
+
</pre>
|
481
|
+
</div>
|
482
|
+
</div>
|
483
|
+
</div>
|
484
|
+
|
485
|
+
<div id="method-M000011" class="method-detail">
|
486
|
+
<a name="M000011"></a>
|
487
|
+
|
488
|
+
<div class="method-heading">
|
489
|
+
<a href="#M000011" class="method-signature">
|
490
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
491
|
+
</a>
|
492
|
+
</div>
|
493
|
+
|
494
|
+
<div class="method-description">
|
495
|
+
<p>
|
496
|
+
retuns this event’s xml.
|
497
|
+
</p>
|
498
|
+
<p><a class="source-toggle" href="#"
|
499
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
500
|
+
<div class="method-source-code" id="M000011-source">
|
501
|
+
<pre>
|
502
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/event.rb, line 154</span>
|
503
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
504
|
+
<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>
|
505
|
+
<span class="ruby-identifier">instance_to_xml</span>
|
506
|
+
<span class="ruby-ivar">@xml</span>.<span class="ruby-identifier">to_s</span>
|
507
|
+
<span class="ruby-keyword kw">end</span>
|
508
|
+
</pre>
|
509
|
+
</div>
|
510
|
+
</div>
|
511
|
+
</div>
|
512
|
+
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
</div>
|
518
|
+
|
519
|
+
|
520
|
+
<div id="validator-badges">
|
521
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
522
|
+
</div>
|
523
|
+
|
524
|
+
</body>
|
525
|
+
</html>
|