gcalapi 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/html/classes/GoogleCalendar.html +149 -149
- data/html/classes/GoogleCalendar/AuthSubFailed.html +162 -162
- data/html/classes/GoogleCalendar/AuthSubUtil.html +352 -352
- data/html/classes/GoogleCalendar/AuthenticationFailed.html +110 -110
- data/html/classes/GoogleCalendar/Calendar.html +381 -381
- data/html/classes/GoogleCalendar/Event.html +699 -699
- data/html/classes/GoogleCalendar/EventDeleteFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventGetFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventInsertFailed.html +110 -110
- data/html/classes/GoogleCalendar/EventUpdateFailed.html +110 -110
- data/html/classes/GoogleCalendar/InvalidCalendarURL.html +110 -110
- data/html/classes/GoogleCalendar/Service.html +245 -305
- data/html/classes/GoogleCalendar/ServiceAuthSub.html +176 -176
- data/html/classes/GoogleCalendar/ServiceBase.html +752 -693
- data/html/created.rid +1 -1
- data/html/files/README.html +117 -117
- data/html/files/lib/googlecalendar/auth_sub_util_rb.html +110 -110
- data/html/files/lib/googlecalendar/calendar_rb.html +109 -109
- data/html/files/lib/googlecalendar/event_rb.html +109 -109
- data/html/files/lib/googlecalendar/service_auth_sub_rb.html +107 -107
- data/html/files/lib/googlecalendar/service_base_rb.html +113 -113
- data/html/files/lib/googlecalendar/service_rb.html +107 -107
- data/html/fr_class_index.html +39 -39
- data/html/fr_file_index.html +32 -32
- data/html/fr_method_index.html +75 -75
- data/html/index.html +23 -23
- data/html/rdoc-style.css +207 -207
- data/lib/googlecalendar/service.rb +1 -18
- data/lib/googlecalendar/service_base.rb +17 -0
- data/test/03_authsub_test.rb +14 -2
- data/test/all.bat +1 -0
- data/test/all.sh +0 -0
- data/test/each.sh +0 -0
- metadata +47 -70
- data/VERSION.BAK +0 -1
@@ -1,111 +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_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
|
-
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>
|
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_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
|
+
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
111
|
</html>
|
@@ -1,382 +1,382 @@
|
|
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="#
|
118
|
-
<a href="#
|
119
|
-
<a href="#
|
120
|
-
<a href="#
|
121
|
-
<a href="#
|
122
|
-
<a href="#
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
|
126
|
-
</div>
|
127
|
-
|
128
|
-
|
129
|
-
<!-- if includes -->
|
130
|
-
|
131
|
-
<div id="section">
|
132
|
-
|
133
|
-
|
134
|
-
<div id="constants-list">
|
135
|
-
<h3 class="section-bar">Constants</h3>
|
136
|
-
|
137
|
-
<div class="name-list">
|
138
|
-
<table summary="Constants">
|
139
|
-
<tr class="top-aligned-row context-row">
|
140
|
-
<td class="context-item-name">DEFAULT_CALENDAR_FEED</td>
|
141
|
-
<td>=</td>
|
142
|
-
<td class="context-item-value">"http://www.google.com/calendar/feeds/default/private/full"</td>
|
143
|
-
</tr>
|
144
|
-
<tr class="top-aligned-row context-row">
|
145
|
-
<td class="context-item-name">ATTRIBUTES</td>
|
146
|
-
<td>=</td>
|
147
|
-
<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>
|
148
|
-
<td width="3em"> </td>
|
149
|
-
<td class="context-item-desc">
|
150
|
-
defines calendar‘s readonly attributes
|
151
|
-
|
152
|
-
</td>
|
153
|
-
</tr>
|
154
|
-
</table>
|
155
|
-
</div>
|
156
|
-
</div>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
<div id="attribute-list">
|
161
|
-
<h3 class="section-bar">Attributes</h3>
|
162
|
-
|
163
|
-
<div class="name-list">
|
164
|
-
<table>
|
165
|
-
<tr class="top-aligned-row context-row">
|
166
|
-
<td class="context-item-name">feed</td>
|
167
|
-
<td class="context-item-value"> [R] </td>
|
168
|
-
<td class="context-item-desc"></td>
|
169
|
-
</tr>
|
170
|
-
</table>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
<!-- if method_list -->
|
177
|
-
<div id="methods">
|
178
|
-
<h3 class="section-bar">Public Class methods</h3>
|
179
|
-
|
180
|
-
<div id="method-
|
181
|
-
<a name="
|
182
|
-
|
183
|
-
<div class="method-heading">
|
184
|
-
<a href="#
|
185
|
-
<span class="method-name">calendars</span><span class="method-args">(srv)</span>
|
186
|
-
</a>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<div class="method-description">
|
190
|
-
<p>
|
191
|
-
get user‘s calendar list.
|
192
|
-
</p>
|
193
|
-
<p><a class="source-toggle" href="#"
|
194
|
-
onclick="toggleCode('
|
195
|
-
<div class="method-source-code" id="
|
196
|
-
<pre>
|
197
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 95</span>
|
198
|
-
95: <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>)
|
199
|
-
96: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">srv</span>.<span class="ruby-identifier">calendar_list</span>
|
200
|
-
97: <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>)
|
201
|
-
98: <span class="ruby-identifier">h</span> = {}
|
202
|
-
99: <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>
|
203
|
-
100: <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>
|
204
|
-
101: <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>]
|
205
|
-
102: <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>)
|
206
|
-
103: <span class="ruby-keyword kw">end</span>
|
207
|
-
104: <span class="ruby-keyword kw">end</span>
|
208
|
-
105: <span class="ruby-identifier">h</span>
|
209
|
-
106: <span class="ruby-keyword kw">end</span>
|
210
|
-
</pre>
|
211
|
-
</div>
|
212
|
-
</div>
|
213
|
-
</div>
|
214
|
-
|
215
|
-
<div id="method-
|
216
|
-
<a name="
|
217
|
-
|
218
|
-
<div class="method-heading">
|
219
|
-
<a href="#
|
220
|
-
<span class="method-name">new</span><span class="method-args">(srv, feed = DEFAULT_CALENDAR_FEED)</span>
|
221
|
-
</a>
|
222
|
-
</div>
|
223
|
-
|
224
|
-
<div class="method-description">
|
225
|
-
<p>
|
226
|
-
srv: <a href="Service.html">GoogleCalendar::Service</a> object feed: <a
|
227
|
-
href="Calendar.html">Calendar</a>‘s editable feed url(default value:
|
228
|
-
user‘s default calendar)
|
229
|
-
</p>
|
230
|
-
<p><a class="source-toggle" href="#"
|
231
|
-
onclick="toggleCode('
|
232
|
-
<div class="method-source-code" id="
|
233
|
-
<pre>
|
234
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 38</span>
|
235
|
-
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">srv</span>, <span class="ruby-identifier">feed</span> = <span class="ruby-constant">DEFAULT_CALENDAR_FEED</span>)
|
236
|
-
39: <span class="ruby-ivar">@srv</span> = <span class="ruby-identifier">srv</span>
|
237
|
-
40: <span class="ruby-ivar">@feed</span> = <span class="ruby-identifier">feed</span>
|
238
|
-
41: <span class="ruby-ivar">@source</span> = <span class="ruby-keyword kw">nil</span>
|
239
|
-
42: <span class="ruby-keyword kw">end</span>
|
240
|
-
</pre>
|
241
|
-
</div>
|
242
|
-
</div>
|
243
|
-
</div>
|
244
|
-
|
245
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
246
|
-
|
247
|
-
<div id="method-
|
248
|
-
<a name="
|
249
|
-
|
250
|
-
<div class="method-heading">
|
251
|
-
<a href="#
|
252
|
-
<span class="method-name">create_event</span><span class="method-args">()</span>
|
253
|
-
</a>
|
254
|
-
</div>
|
255
|
-
|
256
|
-
<div class="method-description">
|
257
|
-
<p>
|
258
|
-
creates a <a href="Calendar.html#
|
259
|
-
href="Event.html">Event</a> instance which belongs to this clandar
|
260
|
-
instance.
|
261
|
-
</p>
|
262
|
-
<p><a class="source-toggle" href="#"
|
263
|
-
onclick="toggleCode('
|
264
|
-
<div class="method-source-code" id="
|
265
|
-
<pre>
|
266
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 73</span>
|
267
|
-
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_event</span>
|
268
|
-
74: <span class="ruby-identifier">ev</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>
|
269
|
-
75: <span class="ruby-identifier">ev</span>.<span class="ruby-identifier">srv</span> = <span class="ruby-ivar">@srv</span>
|
270
|
-
76: <span class="ruby-identifier">ev</span>.<span class="ruby-identifier">feed</span> = <span class="ruby-ivar">@feed</span>
|
271
|
-
77: <span class="ruby-identifier">ev</span>
|
272
|
-
78: <span class="ruby-keyword kw">end</span>
|
273
|
-
</pre>
|
274
|
-
</div>
|
275
|
-
</div>
|
276
|
-
</div>
|
277
|
-
|
278
|
-
<div id="method-
|
279
|
-
<a name="
|
280
|
-
|
281
|
-
<div class="method-heading">
|
282
|
-
<a href="#
|
283
|
-
<span class="method-name">events</span><span class="method-args">(conditions = {})</span>
|
284
|
-
</a>
|
285
|
-
</div>
|
286
|
-
|
287
|
-
<div class="method-description">
|
288
|
-
<p>
|
289
|
-
send query to get <a href="Calendar.html#
|
290
|
-
array of <a href="Event.html">Event</a> objects. if any conditions are
|
291
|
-
given, recent 25 entries are retrieved. For detail, see Service#query
|
292
|
-
</p>
|
293
|
-
<p><a class="source-toggle" href="#"
|
294
|
-
onclick="toggleCode('
|
295
|
-
<div class="method-source-code" id="
|
296
|
-
<pre>
|
297
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 57</span>
|
298
|
-
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">events</span>(<span class="ruby-identifier">conditions</span> = {})
|
299
|
-
58: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">query</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">conditions</span>)
|
300
|
-
59: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidCalendarURL</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>
|
301
|
-
60: <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>).<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span>(<span class="ruby-value str">"entry"</span>){}.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">elem</span><span class="ruby-operator">|</span>
|
302
|
-
61: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"xmlns:gCal"</span>] = <span class="ruby-value str">"http://schemas.google.com/gCal/2005"</span>
|
303
|
-
62: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"xmlns:gd"</span>] = <span class="ruby-value str">"http://schemas.google.com/g/2005"</span>
|
304
|
-
63: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"xmlns"</span>] = <span class="ruby-value str">"http://www.w3.org/2005/Atom"</span>
|
305
|
-
64: <span class="ruby-identifier">entry</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>
|
306
|
-
65: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">srv</span> = <span class="ruby-ivar">@srv</span>
|
307
|
-
66: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">load_xml</span>(<span class="ruby-node">"<?xml version='1.0' encoding='UTF-8'?>#{elem.to_s}"</span>)
|
308
|
-
67: <span class="ruby-keyword kw">end</span>
|
309
|
-
68: <span class="ruby-keyword kw">end</span>
|
310
|
-
</pre>
|
311
|
-
</div>
|
312
|
-
</div>
|
313
|
-
</div>
|
314
|
-
|
315
|
-
<div id="method-
|
316
|
-
<a name="
|
317
|
-
|
318
|
-
<div class="method-heading">
|
319
|
-
<a href="#
|
320
|
-
<span class="method-name">source</span><span class="method-args">()</span>
|
321
|
-
</a>
|
322
|
-
</div>
|
323
|
-
|
324
|
-
<div class="method-description">
|
325
|
-
<p>
|
326
|
-
REXML::Document object which represents calendar object
|
327
|
-
</p>
|
328
|
-
<p><a class="source-toggle" href="#"
|
329
|
-
onclick="toggleCode('
|
330
|
-
<div class="method-source-code" id="
|
331
|
-
<pre>
|
332
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 47</span>
|
333
|
-
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">source</span>
|
334
|
-
48: <span class="ruby-ivar">@source</span> = <span class="ruby-identifier">get_data</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@source</span>
|
335
|
-
49: <span class="ruby-ivar">@source</span>
|
336
|
-
50: <span class="ruby-keyword kw">end</span>
|
337
|
-
</pre>
|
338
|
-
</div>
|
339
|
-
</div>
|
340
|
-
</div>
|
341
|
-
|
342
|
-
<h3 class="section-bar">Private Instance methods</h3>
|
343
|
-
|
344
|
-
<div id="method-
|
345
|
-
<a name="
|
346
|
-
|
347
|
-
<div class="method-heading">
|
348
|
-
<a href="#
|
349
|
-
<span class="method-name">get_data</span><span class="method-args">()</span>
|
350
|
-
</a>
|
351
|
-
</div>
|
352
|
-
|
353
|
-
<div class="method-description">
|
354
|
-
<p><a class="source-toggle" href="#"
|
355
|
-
onclick="toggleCode('
|
356
|
-
<div class="method-source-code" id="
|
357
|
-
<pre>
|
358
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 82</span>
|
359
|
-
82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_data</span>
|
360
|
-
83: <span class="ruby-comment cmt">#gets calendar data without events</span>
|
361
|
-
84: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">query</span>(<span class="ruby-ivar">@feed</span>, <span class="ruby-value str">"start-min"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>, <span class="ruby-value str">"start-max"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
|
362
|
-
85: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidCalendarURL</span>, <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">inspect</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>
|
363
|
-
86: <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>)
|
364
|
-
87: <span class="ruby-keyword kw">end</span>
|
365
|
-
</pre>
|
366
|
-
</div>
|
367
|
-
</div>
|
368
|
-
</div>
|
369
|
-
|
370
|
-
|
371
|
-
</div>
|
372
|
-
|
373
|
-
|
374
|
-
</div>
|
375
|
-
|
376
|
-
|
377
|
-
<div id="validator-badges">
|
378
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
379
|
-
</div>
|
380
|
-
|
381
|
-
</body>
|
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="#M000015">calendars</a>
|
118
|
+
<a href="#M000013">create_event</a>
|
119
|
+
<a href="#M000012">events</a>
|
120
|
+
<a href="#M000014">get_data</a>
|
121
|
+
<a href="#M000010">new</a>
|
122
|
+
<a href="#M000011">source</a>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
<!-- if includes -->
|
130
|
+
|
131
|
+
<div id="section">
|
132
|
+
|
133
|
+
|
134
|
+
<div id="constants-list">
|
135
|
+
<h3 class="section-bar">Constants</h3>
|
136
|
+
|
137
|
+
<div class="name-list">
|
138
|
+
<table summary="Constants">
|
139
|
+
<tr class="top-aligned-row context-row">
|
140
|
+
<td class="context-item-name">DEFAULT_CALENDAR_FEED</td>
|
141
|
+
<td>=</td>
|
142
|
+
<td class="context-item-value">"http://www.google.com/calendar/feeds/default/private/full"</td>
|
143
|
+
</tr>
|
144
|
+
<tr class="top-aligned-row context-row">
|
145
|
+
<td class="context-item-name">ATTRIBUTES</td>
|
146
|
+
<td>=</td>
|
147
|
+
<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>
|
148
|
+
<td width="3em"> </td>
|
149
|
+
<td class="context-item-desc">
|
150
|
+
defines calendar‘s readonly attributes
|
151
|
+
|
152
|
+
</td>
|
153
|
+
</tr>
|
154
|
+
</table>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<div id="attribute-list">
|
161
|
+
<h3 class="section-bar">Attributes</h3>
|
162
|
+
|
163
|
+
<div class="name-list">
|
164
|
+
<table>
|
165
|
+
<tr class="top-aligned-row context-row">
|
166
|
+
<td class="context-item-name">feed</td>
|
167
|
+
<td class="context-item-value"> [R] </td>
|
168
|
+
<td class="context-item-desc"></td>
|
169
|
+
</tr>
|
170
|
+
</table>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<!-- if method_list -->
|
177
|
+
<div id="methods">
|
178
|
+
<h3 class="section-bar">Public Class methods</h3>
|
179
|
+
|
180
|
+
<div id="method-M000015" class="method-detail">
|
181
|
+
<a name="M000015"></a>
|
182
|
+
|
183
|
+
<div class="method-heading">
|
184
|
+
<a href="#M000015" class="method-signature">
|
185
|
+
<span class="method-name">calendars</span><span class="method-args">(srv)</span>
|
186
|
+
</a>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="method-description">
|
190
|
+
<p>
|
191
|
+
get user‘s calendar list.
|
192
|
+
</p>
|
193
|
+
<p><a class="source-toggle" href="#"
|
194
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
195
|
+
<div class="method-source-code" id="M000015-source">
|
196
|
+
<pre>
|
197
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 95</span>
|
198
|
+
95: <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>)
|
199
|
+
96: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">srv</span>.<span class="ruby-identifier">calendar_list</span>
|
200
|
+
97: <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>)
|
201
|
+
98: <span class="ruby-identifier">h</span> = {}
|
202
|
+
99: <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>
|
203
|
+
100: <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>
|
204
|
+
101: <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>]
|
205
|
+
102: <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>)
|
206
|
+
103: <span class="ruby-keyword kw">end</span>
|
207
|
+
104: <span class="ruby-keyword kw">end</span>
|
208
|
+
105: <span class="ruby-identifier">h</span>
|
209
|
+
106: <span class="ruby-keyword kw">end</span>
|
210
|
+
</pre>
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div id="method-M000010" class="method-detail">
|
216
|
+
<a name="M000010"></a>
|
217
|
+
|
218
|
+
<div class="method-heading">
|
219
|
+
<a href="#M000010" class="method-signature">
|
220
|
+
<span class="method-name">new</span><span class="method-args">(srv, feed = DEFAULT_CALENDAR_FEED)</span>
|
221
|
+
</a>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div class="method-description">
|
225
|
+
<p>
|
226
|
+
srv: <a href="Service.html">GoogleCalendar::Service</a> object feed: <a
|
227
|
+
href="Calendar.html">Calendar</a>‘s editable feed url(default value:
|
228
|
+
user‘s default calendar)
|
229
|
+
</p>
|
230
|
+
<p><a class="source-toggle" href="#"
|
231
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
232
|
+
<div class="method-source-code" id="M000010-source">
|
233
|
+
<pre>
|
234
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 38</span>
|
235
|
+
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">srv</span>, <span class="ruby-identifier">feed</span> = <span class="ruby-constant">DEFAULT_CALENDAR_FEED</span>)
|
236
|
+
39: <span class="ruby-ivar">@srv</span> = <span class="ruby-identifier">srv</span>
|
237
|
+
40: <span class="ruby-ivar">@feed</span> = <span class="ruby-identifier">feed</span>
|
238
|
+
41: <span class="ruby-ivar">@source</span> = <span class="ruby-keyword kw">nil</span>
|
239
|
+
42: <span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
246
|
+
|
247
|
+
<div id="method-M000013" class="method-detail">
|
248
|
+
<a name="M000013"></a>
|
249
|
+
|
250
|
+
<div class="method-heading">
|
251
|
+
<a href="#M000013" class="method-signature">
|
252
|
+
<span class="method-name">create_event</span><span class="method-args">()</span>
|
253
|
+
</a>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div class="method-description">
|
257
|
+
<p>
|
258
|
+
creates a <a href="Calendar.html#M000010">new</a> <a
|
259
|
+
href="Event.html">Event</a> instance which belongs to this clandar
|
260
|
+
instance.
|
261
|
+
</p>
|
262
|
+
<p><a class="source-toggle" href="#"
|
263
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
264
|
+
<div class="method-source-code" id="M000013-source">
|
265
|
+
<pre>
|
266
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 73</span>
|
267
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_event</span>
|
268
|
+
74: <span class="ruby-identifier">ev</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>
|
269
|
+
75: <span class="ruby-identifier">ev</span>.<span class="ruby-identifier">srv</span> = <span class="ruby-ivar">@srv</span>
|
270
|
+
76: <span class="ruby-identifier">ev</span>.<span class="ruby-identifier">feed</span> = <span class="ruby-ivar">@feed</span>
|
271
|
+
77: <span class="ruby-identifier">ev</span>
|
272
|
+
78: <span class="ruby-keyword kw">end</span>
|
273
|
+
</pre>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div id="method-M000012" class="method-detail">
|
279
|
+
<a name="M000012"></a>
|
280
|
+
|
281
|
+
<div class="method-heading">
|
282
|
+
<a href="#M000012" class="method-signature">
|
283
|
+
<span class="method-name">events</span><span class="method-args">(conditions = {})</span>
|
284
|
+
</a>
|
285
|
+
</div>
|
286
|
+
|
287
|
+
<div class="method-description">
|
288
|
+
<p>
|
289
|
+
send query to get <a href="Calendar.html#M000012">events</a> and returns an
|
290
|
+
array of <a href="Event.html">Event</a> objects. if any conditions are
|
291
|
+
given, recent 25 entries are retrieved. For detail, see Service#query
|
292
|
+
</p>
|
293
|
+
<p><a class="source-toggle" href="#"
|
294
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
295
|
+
<div class="method-source-code" id="M000012-source">
|
296
|
+
<pre>
|
297
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 57</span>
|
298
|
+
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">events</span>(<span class="ruby-identifier">conditions</span> = {})
|
299
|
+
58: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">query</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">conditions</span>)
|
300
|
+
59: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidCalendarURL</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>
|
301
|
+
60: <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>).<span class="ruby-identifier">root</span>.<span class="ruby-identifier">elements</span>.<span class="ruby-identifier">each</span>(<span class="ruby-value str">"entry"</span>){}.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">elem</span><span class="ruby-operator">|</span>
|
302
|
+
61: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"xmlns:gCal"</span>] = <span class="ruby-value str">"http://schemas.google.com/gCal/2005"</span>
|
303
|
+
62: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"xmlns:gd"</span>] = <span class="ruby-value str">"http://schemas.google.com/g/2005"</span>
|
304
|
+
63: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">"xmlns"</span>] = <span class="ruby-value str">"http://www.w3.org/2005/Atom"</span>
|
305
|
+
64: <span class="ruby-identifier">entry</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>
|
306
|
+
65: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">srv</span> = <span class="ruby-ivar">@srv</span>
|
307
|
+
66: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">load_xml</span>(<span class="ruby-node">"<?xml version='1.0' encoding='UTF-8'?>#{elem.to_s}"</span>)
|
308
|
+
67: <span class="ruby-keyword kw">end</span>
|
309
|
+
68: <span class="ruby-keyword kw">end</span>
|
310
|
+
</pre>
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
<div id="method-M000011" class="method-detail">
|
316
|
+
<a name="M000011"></a>
|
317
|
+
|
318
|
+
<div class="method-heading">
|
319
|
+
<a href="#M000011" class="method-signature">
|
320
|
+
<span class="method-name">source</span><span class="method-args">()</span>
|
321
|
+
</a>
|
322
|
+
</div>
|
323
|
+
|
324
|
+
<div class="method-description">
|
325
|
+
<p>
|
326
|
+
REXML::Document object which represents calendar object
|
327
|
+
</p>
|
328
|
+
<p><a class="source-toggle" href="#"
|
329
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
330
|
+
<div class="method-source-code" id="M000011-source">
|
331
|
+
<pre>
|
332
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 47</span>
|
333
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">source</span>
|
334
|
+
48: <span class="ruby-ivar">@source</span> = <span class="ruby-identifier">get_data</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@source</span>
|
335
|
+
49: <span class="ruby-ivar">@source</span>
|
336
|
+
50: <span class="ruby-keyword kw">end</span>
|
337
|
+
</pre>
|
338
|
+
</div>
|
339
|
+
</div>
|
340
|
+
</div>
|
341
|
+
|
342
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
343
|
+
|
344
|
+
<div id="method-M000014" class="method-detail">
|
345
|
+
<a name="M000014"></a>
|
346
|
+
|
347
|
+
<div class="method-heading">
|
348
|
+
<a href="#M000014" class="method-signature">
|
349
|
+
<span class="method-name">get_data</span><span class="method-args">()</span>
|
350
|
+
</a>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
<div class="method-description">
|
354
|
+
<p><a class="source-toggle" href="#"
|
355
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
356
|
+
<div class="method-source-code" id="M000014-source">
|
357
|
+
<pre>
|
358
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/calendar.rb, line 82</span>
|
359
|
+
82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_data</span>
|
360
|
+
83: <span class="ruby-comment cmt">#gets calendar data without events</span>
|
361
|
+
84: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">query</span>(<span class="ruby-ivar">@feed</span>, <span class="ruby-value str">"start-min"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>, <span class="ruby-value str">"start-max"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
|
362
|
+
85: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidCalendarURL</span>, <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">inspect</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>
|
363
|
+
86: <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>)
|
364
|
+
87: <span class="ruby-keyword kw">end</span>
|
365
|
+
</pre>
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
</div>
|
375
|
+
|
376
|
+
|
377
|
+
<div id="validator-badges">
|
378
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
379
|
+
</div>
|
380
|
+
|
381
|
+
</body>
|
382
382
|
</html>
|