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.
Files changed (42) hide show
  1. data/Rakefile +19 -15
  2. data/VERSION +1 -1
  3. data/example/mixi2gcal.rb +88 -0
  4. data/html/classes/GoogleCalendar.html +149 -280
  5. data/html/classes/GoogleCalendar/AuthSubFailed.html +165 -0
  6. data/html/classes/GoogleCalendar/AuthSubUtil.html +397 -0
  7. data/html/classes/GoogleCalendar/AuthenticationFailed.html +110 -110
  8. data/html/classes/GoogleCalendar/Calendar.html +381 -203
  9. data/html/classes/GoogleCalendar/Event.html +800 -510
  10. data/html/classes/GoogleCalendar/EventDeleteFailed.html +110 -110
  11. data/html/classes/GoogleCalendar/EventGetFailed.html +111 -0
  12. data/html/classes/GoogleCalendar/EventInsertFailed.html +110 -110
  13. data/html/classes/GoogleCalendar/EventUpdateFailed.html +110 -110
  14. data/html/classes/GoogleCalendar/InvalidCalendarURL.html +110 -110
  15. data/html/classes/GoogleCalendar/Service.html +305 -594
  16. data/html/classes/GoogleCalendar/ServiceAuthSub.html +181 -0
  17. data/html/classes/GoogleCalendar/ServiceBase.html +694 -0
  18. data/html/created.rid +1 -1
  19. data/html/files/README.html +116 -116
  20. data/html/files/lib/googlecalendar/auth_sub_util_rb.html +111 -0
  21. data/html/files/lib/googlecalendar/calendar_rb.html +109 -109
  22. data/html/files/lib/googlecalendar/event_rb.html +109 -109
  23. data/html/files/lib/googlecalendar/service_auth_sub_rb.html +108 -0
  24. data/html/files/lib/googlecalendar/service_base_rb.html +114 -0
  25. data/html/files/lib/googlecalendar/service_rb.html +107 -113
  26. data/html/fr_class_index.html +39 -34
  27. data/html/fr_file_index.html +32 -29
  28. data/html/fr_method_index.html +75 -52
  29. data/html/index.html +23 -23
  30. data/html/rdoc-style.css +207 -207
  31. data/lib/googlecalendar/auth_sub_util.rb +143 -0
  32. data/lib/googlecalendar/calendar.rb +48 -36
  33. data/lib/googlecalendar/event.rb +16 -11
  34. data/lib/googlecalendar/service.rb +30 -180
  35. data/lib/googlecalendar/service_auth_sub.rb +18 -0
  36. data/lib/googlecalendar/service_base.rb +197 -0
  37. data/test/00_service_test.rb +2 -1
  38. data/test/01_calendar_test.rb +1 -1
  39. data/test/02_event_test.rb +28 -1
  40. data/test/03_authsub_test.rb +119 -0
  41. data/test/base_unit.rb +3 -0
  42. metadata +105 -62
@@ -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_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>
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,204 +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&#8217;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>&nbsp;&nbsp;
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">{ &quot;updated&quot; =&gt; [&quot;updated&quot;], &quot;title&quot; =&gt; [&quot;title&quot;], &quot;subtitle&quot; =&gt; [&quot;subtitle&quot;], &quot;name&quot; =&gt; [&quot;author/name&quot;], &quot;email&quot; =&gt; [&quot;author/email&quot;], &quot;timezone&quot; =&gt; [&quot;gCal:timezone&quot;, &quot;value&quot;], &quot;where&quot; =&gt; [&quot;gd:where&quot;, &quot;valueString&quot;]}.each do |key, val| module_eval( &quot;def #{key}; self.source.root.elements[\&quot;#{val[0]}\&quot;].&quot; + (val.length == 1 ? &quot;text&quot; : &quot;attributes[\&quot;#{val[1]}\&quot;]&quot;) + &quot;; end&quot;</td>
138
- <td width="3em">&nbsp;</td>
139
- <td class="context-item-desc">
140
- defines calendar&#8217;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&#8217;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">&quot;entry/link&quot;</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">&quot;rel&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;alternate&quot;</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">&quot;href&quot;</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>
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&#8216;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="#M000028">calendars</a>&nbsp;&nbsp;
118
+ <a href="#M000026">create_event</a>&nbsp;&nbsp;
119
+ <a href="#M000025">events</a>&nbsp;&nbsp;
120
+ <a href="#M000027">get_data</a>&nbsp;&nbsp;
121
+ <a href="#M000023">new</a>&nbsp;&nbsp;
122
+ <a href="#M000024">source</a>&nbsp;&nbsp;
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">&quot;http://www.google.com/calendar/feeds/default/private/full&quot;</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">{ &quot;updated&quot; =&gt; [&quot;updated&quot;], &quot;title&quot; =&gt; [&quot;title&quot;], &quot;subtitle&quot; =&gt; [&quot;subtitle&quot;], &quot;name&quot; =&gt; [&quot;author/name&quot;], &quot;email&quot; =&gt; [&quot;author/email&quot;], &quot;timezone&quot; =&gt; [&quot;gCal:timezone&quot;, &quot;value&quot;], &quot;where&quot; =&gt; [&quot;gd:where&quot;, &quot;valueString&quot;]}.each do |key, val| module_eval( &quot;def #{key}; self.source.root.elements[\&quot;#{val[0]}\&quot;].&quot; + (val.length == 1 ? &quot;text&quot; : &quot;attributes[\&quot;#{val[1]}\&quot;]&quot;) + &quot;; end&quot;</td>
148
+ <td width="3em">&nbsp;</td>
149
+ <td class="context-item-desc">
150
+ defines calendar&#8216;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">&nbsp;[R]&nbsp;</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-M000028" class="method-detail">
181
+ <a name="M000028"></a>
182
+
183
+ <div class="method-heading">
184
+ <a href="#M000028" 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&#8216;s calendar list.
192
+ </p>
193
+ <p><a class="source-toggle" href="#"
194
+ onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
195
+ <div class="method-source-code" id="M000028-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">&quot;entry/link&quot;</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">&quot;rel&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;alternate&quot;</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">&quot;href&quot;</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-M000023" class="method-detail">
216
+ <a name="M000023"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="#M000023" 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>&#8216;s editable feed url(default value:
228
+ user&#8216;s default calendar)
229
+ </p>
230
+ <p><a class="source-toggle" href="#"
231
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
232
+ <div class="method-source-code" id="M000023-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-M000026" class="method-detail">
248
+ <a name="M000026"></a>
249
+
250
+ <div class="method-heading">
251
+ <a href="#M000026" 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#M000023">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('M000026-source');return false;">[Source]</a></p>
264
+ <div class="method-source-code" id="M000026-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-M000025" class="method-detail">
279
+ <a name="M000025"></a>
280
+
281
+ <div class="method-heading">
282
+ <a href="#M000025" 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#M000025">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('M000025-source');return false;">[Source]</a></p>
295
+ <div class="method-source-code" id="M000025-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">&quot;200&quot;</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">&quot;entry&quot;</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">&quot;xmlns:gCal&quot;</span>] = <span class="ruby-value str">&quot;http://schemas.google.com/gCal/2005&quot;</span>
303
+ 62: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;xmlns:gd&quot;</span>] = <span class="ruby-value str">&quot;http://schemas.google.com/g/2005&quot;</span>
304
+ 63: <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">&quot;xmlns&quot;</span>] = <span class="ruby-value str">&quot;http://www.w3.org/2005/Atom&quot;</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">&quot;&lt;?xml version='1.0' encoding='UTF-8'?&gt;#{elem.to_s}&quot;</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-M000024" class="method-detail">
316
+ <a name="M000024"></a>
317
+
318
+ <div class="method-heading">
319
+ <a href="#M000024" 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('M000024-source');return false;">[Source]</a></p>
330
+ <div class="method-source-code" id="M000024-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-M000027" class="method-detail">
345
+ <a name="M000027"></a>
346
+
347
+ <div class="method-heading">
348
+ <a href="#M000027" 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('M000027-source');return false;">[Source]</a></p>
356
+ <div class="method-source-code" id="M000027-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">&quot;start-min&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>, <span class="ruby-value str">&quot;start-max&quot;</span> =<span class="ruby-operator">&gt;</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">&quot;200&quot;</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>
204
382
  </html>