gcalapi 0.1.0 → 0.1.1
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 +1 -1
- data/VERSION +1 -1
- data/VERSION.BAK +1 -0
- data/html/classes/GoogleCalendar/Event.html +1 -1
- data/html/classes/GoogleCalendar/ServiceBase.html +90 -89
- data/html/created.rid +1 -1
- data/html/files/README.html +3 -2
- data/html/files/lib/googlecalendar/calendar_rb.html +1 -1
- data/html/files/lib/googlecalendar/event_rb.html +1 -1
- data/html/files/lib/googlecalendar/service_base_rb.html +1 -1
- data/html/files/lib/googlecalendar/service_rb.html +1 -1
- data/lib/googlecalendar/event.rb +1 -1
- data/lib/googlecalendar/service_base.rb +4 -3
- data/test/00_service_test.rb +1 -1
- data/test/03_authsub_test.rb +25 -3
- data/test/base_unit.rb +5 -10
- data/test/template.parameters.rb +2 -0
- metadata +70 -62
data/README
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/VERSION.BAK
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -409,7 +409,7 @@ throws an Exception.
|
|
409
409
|
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy!</span>
|
410
410
|
150: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">nil</span>
|
411
411
|
151: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:old</span>
|
412
|
-
152: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>)
|
412
|
+
152: <span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@srv</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">feed</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>)
|
413
413
|
153: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"Not Deleted"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"200"</span>
|
414
414
|
154: <span class="ruby-keyword kw">else</span>
|
415
415
|
155: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EventDeleteFailed</span>, <span class="ruby-value str">"Not Saved"</span>
|
@@ -352,7 +352,7 @@ Server name to Authenticate
|
|
352
352
|
|
353
353
|
<div class="method-heading">
|
354
354
|
<a href="#M000038" class="method-signature">
|
355
|
-
<span class="method-name">delete</span><span class="method-args">(feed)</span>
|
355
|
+
<span class="method-name">delete</span><span class="method-args">(feed, event)</span>
|
356
356
|
</a>
|
357
357
|
</div>
|
358
358
|
|
@@ -365,16 +365,17 @@ Server name to Authenticate
|
|
365
365
|
<div class="method-source-code" id="M000038-source">
|
366
366
|
<pre>
|
367
367
|
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 95</span>
|
368
|
-
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">feed</span>)
|
368
|
+
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">event</span>)
|
369
369
|
96: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- delete st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
370
370
|
97: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
371
371
|
98: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">feed</span>)
|
372
372
|
99: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>,
|
373
|
-
100: {<span class="ruby-value str">"X-HTTP-Method-Override"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"DELETE"</span
|
374
|
-
101: <span class="ruby-value str">"
|
375
|
-
102:
|
376
|
-
103: <span class="ruby-identifier">res</span>
|
377
|
-
104:
|
373
|
+
100: {<span class="ruby-value str">"X-HTTP-Method-Override"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"DELETE"</span>,
|
374
|
+
101: <span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/atom+xml"</span>,
|
375
|
+
102: <span class="ruby-value str">"Content-Length"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>}, <span class="ruby-identifier">event</span>)
|
376
|
+
103: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- delete en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
377
|
+
104: <span class="ruby-identifier">res</span>
|
378
|
+
105: <span class="ruby-keyword kw">end</span>
|
378
379
|
</pre>
|
379
380
|
</div>
|
380
381
|
</div>
|
@@ -397,17 +398,17 @@ Server name to Authenticate
|
|
397
398
|
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
398
399
|
<div class="method-source-code" id="M000039-source">
|
399
400
|
<pre>
|
400
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
401
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 110</span>
|
402
|
+
110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert</span>(<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">event</span>)
|
403
|
+
111: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- insert st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
404
|
+
112: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
405
|
+
113: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">feed</span>)
|
406
|
+
114: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>,
|
407
|
+
115: {<span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/atom+xml"</span>,
|
408
|
+
116: <span class="ruby-value str">"Content-Length"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>}, <span class="ruby-identifier">event</span>)
|
409
|
+
117: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- insert en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
410
|
+
118: <span class="ruby-identifier">res</span>
|
411
|
+
119: <span class="ruby-keyword kw">end</span>
|
411
412
|
</pre>
|
412
413
|
</div>
|
413
414
|
</div>
|
@@ -503,18 +504,18 @@ href="http://code.google.com/apis/gdata/protocol.html#Queries">code.google.com/a
|
|
503
504
|
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
504
505
|
<div class="method-source-code" id="M000040-source">
|
505
506
|
<pre>
|
506
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
507
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 124</span>
|
508
|
+
124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">feed</span>, <span class="ruby-identifier">event</span>)
|
509
|
+
125: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">"-- update st --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
510
|
+
126: <span class="ruby-identifier">auth</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@auth</span>
|
511
|
+
127: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">feed</span>)
|
512
|
+
128: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>,
|
513
|
+
129: {<span class="ruby-value str">"X-HTTP-Method-Override"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"PUT"</span>,
|
514
|
+
130: <span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"application/atom+xml"</span>,
|
515
|
+
131: <span class="ruby-value str">"Content-Length"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_s</span>}, <span class="ruby-identifier">event</span>)
|
516
|
+
132: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"-- update en (#{res.message}) --"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
517
|
+
133: <span class="ruby-identifier">res</span>
|
518
|
+
134: <span class="ruby-keyword kw">end</span>
|
518
519
|
</pre>
|
519
520
|
</div>
|
520
521
|
</div>
|
@@ -539,10 +540,10 @@ authencate
|
|
539
540
|
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
540
541
|
<div class="method-source-code" id="M000041-source">
|
541
542
|
<pre>
|
542
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
543
|
-
|
544
|
-
|
545
|
-
|
543
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 139</span>
|
544
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auth</span>
|
545
|
+
140: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AuthenticationFailed</span>
|
546
|
+
141: <span class="ruby-keyword kw">end</span>
|
546
547
|
</pre>
|
547
548
|
</div>
|
548
549
|
</div>
|
@@ -562,15 +563,15 @@ authencate
|
|
562
563
|
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
563
564
|
<div class="method-source-code" id="M000043-source">
|
564
565
|
<pre>
|
565
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
566
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 153</span>
|
567
|
+
153: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_get</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>)
|
568
|
+
154: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-value str">"GET:"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
569
|
+
155: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
570
|
+
156: <span class="ruby-identifier">try_http</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span>,<span class="ruby-identifier">path</span>,<span class="ruby-identifier">head</span><span class="ruby-operator">|</span>
|
571
|
+
157: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">head</span>)
|
572
|
+
158: <span class="ruby-keyword kw">end</span>
|
573
|
+
159: <span class="ruby-identifier">res</span>
|
574
|
+
160: <span class="ruby-keyword kw">end</span>
|
574
575
|
</pre>
|
575
576
|
</div>
|
576
577
|
</div>
|
@@ -590,16 +591,16 @@ authencate
|
|
590
591
|
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
591
592
|
<div class="method-source-code" id="M000042-source">
|
592
593
|
<pre>
|
593
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
594
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 143</span>
|
595
|
+
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_post</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>, <span class="ruby-identifier">content</span>)
|
596
|
+
144: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-value str">"POST:"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
597
|
+
145: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
598
|
+
146: <span class="ruby-identifier">try_http</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>, <span class="ruby-identifier">content</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span>,<span class="ruby-identifier">path</span>,<span class="ruby-identifier">head</span>,<span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
599
|
+
147: <span class="ruby-identifier">cont</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
600
|
+
148: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">cont</span>, <span class="ruby-identifier">head</span>)
|
601
|
+
149: <span class="ruby-keyword kw">end</span>
|
602
|
+
150: <span class="ruby-identifier">res</span>
|
603
|
+
151: <span class="ruby-keyword kw">end</span>
|
603
604
|
</pre>
|
604
605
|
</div>
|
605
606
|
</div>
|
@@ -619,13 +620,13 @@ authencate
|
|
619
620
|
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
620
621
|
<div class="method-source-code" id="M000045-source">
|
621
622
|
<pre>
|
622
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
623
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 191</span>
|
624
|
+
191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path_with_authorized_query</span>(<span class="ruby-identifier">uri</span>)
|
625
|
+
192: <span class="ruby-identifier">query</span> = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-value str">""</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>)
|
626
|
+
193: <span class="ruby-identifier">query</span>[<span class="ruby-value str">"gsessionid"</span>] = [<span class="ruby-ivar">@session</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@session</span>
|
627
|
+
194: <span class="ruby-identifier">qs</span> = <span class="ruby-identifier">query</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{CGI.escape(k)}=#{CGI.escape(v[0])}"</span> <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"&"</span>)
|
628
|
+
195: <span class="ruby-identifier">qs</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#{uri.path}?#{qs}"</span>
|
629
|
+
196: <span class="ruby-keyword kw">end</span>
|
629
630
|
</pre>
|
630
631
|
</div>
|
631
632
|
</div>
|
@@ -645,35 +646,35 @@ authencate
|
|
645
646
|
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
646
647
|
<div class="method-source-code" id="M000044-source">
|
647
648
|
<pre>
|
648
|
-
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
649
|
+
<span class="ruby-comment cmt"># File lib/googlecalendar/service_base.rb, line 162</span>
|
650
|
+
162: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">try_http</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">header</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
651
|
+
163: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">nil</span>
|
652
|
+
164: <span class="ruby-identifier">add_authorize_header</span>(<span class="ruby-identifier">header</span>)
|
653
|
+
165: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>, <span class="ruby-ivar">@@proxy_addr</span>, <span class="ruby-ivar">@@proxy_port</span>, <span class="ruby-ivar">@@proxy_user</span>, <span class="ruby-ivar">@@proxy_pass</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
|
654
|
+
166: <span class="ruby-identifier">header</span>[<span class="ruby-value str">"Cookie"</span>] = <span class="ruby-ivar">@cookie</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cookie</span>
|
655
|
+
167: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">http</span>, <span class="ruby-identifier">path_with_authorized_query</span>(<span class="ruby-identifier">uri</span>), <span class="ruby-identifier">header</span>, <span class="ruby-identifier">args</span>)
|
656
|
+
168: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-identifier">res</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
657
|
+
169: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"302"</span>
|
658
|
+
170: <span class="ruby-identifier">ck</span> = <span class="ruby-identifier">sess</span> = <span class="ruby-keyword kw">nil</span>
|
659
|
+
171: <span class="ruby-identifier">ck</span> = <span class="ruby-identifier">res</span>[<span class="ruby-value str">"set-cookie"</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"set-cookie"</span>)
|
660
|
+
172: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">res</span>[<span class="ruby-value str">"location"</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"location"</span>)
|
661
|
+
173: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>
|
662
|
+
174: <span class="ruby-identifier">qr</span> = <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span>)
|
663
|
+
175: <span class="ruby-identifier">sess</span> = <span class="ruby-identifier">qr</span>[<span class="ruby-value str">"gsessionid"</span>][<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qr</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">"gsessionid"</span>)
|
664
|
+
176: <span class="ruby-keyword kw">end</span>
|
665
|
+
177: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ck</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">sess</span>
|
666
|
+
178: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"cookie: #{ck}, gsessionid:#{sess}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
667
|
+
179: <span class="ruby-identifier">header</span>[<span class="ruby-value str">"Cookie"</span>] = <span class="ruby-ivar">@cookie</span> = <span class="ruby-identifier">ck</span>
|
668
|
+
180: <span class="ruby-ivar">@session</span> = <span class="ruby-identifier">sess</span>
|
669
|
+
181: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">http</span>, <span class="ruby-identifier">path_with_authorized_query</span>(<span class="ruby-identifier">uri</span>), <span class="ruby-identifier">header</span>, <span class="ruby-identifier">args</span>)
|
670
|
+
182: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-identifier">res</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
671
|
+
183: <span class="ruby-keyword kw">else</span>
|
672
|
+
184: <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">fatal</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>, <span class="ruby-value str">' '</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger</span>
|
673
|
+
185: <span class="ruby-keyword kw">end</span>
|
674
|
+
186: <span class="ruby-keyword kw">end</span>
|
675
|
+
187: <span class="ruby-keyword kw">end</span>
|
676
|
+
188: <span class="ruby-identifier">res</span>
|
677
|
+
189: <span class="ruby-keyword kw">end</span>
|
677
678
|
</pre>
|
678
679
|
</div>
|
679
680
|
</div>
|
data/html/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sat, 23 Feb 2008 21:40:01 +0900
|
data/html/files/README.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sun
|
59
|
+
<td>Sun Mar 18 21:53:36 +0900 2007</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -76,7 +76,8 @@
|
|
76
76
|
</pre>
|
77
77
|
<h2>License</h2>
|
78
78
|
<p>
|
79
|
-
This library is public domain software
|
79
|
+
This library is public domain software and provided without warranty of any
|
80
|
+
kind.
|
80
81
|
</p>
|
81
82
|
<h2>Author</h2>
|
82
83
|
<p>
|
data/lib/googlecalendar/event.rb
CHANGED
@@ -148,7 +148,7 @@ XML
|
|
148
148
|
def destroy!
|
149
149
|
ret = nil
|
150
150
|
if self.status == :old
|
151
|
-
ret = @srv.delete(self.feed)
|
151
|
+
ret = @srv.delete(self.feed, self.to_s)
|
152
152
|
raise EventDeleteFailed, "Not Deleted" unless ret.code == "200"
|
153
153
|
else
|
154
154
|
raise EventDeleteFailed, "Not Saved"
|
@@ -92,13 +92,14 @@ module GoogleCalendar
|
|
92
92
|
#
|
93
93
|
# delete an event.
|
94
94
|
#
|
95
|
-
def delete(feed)
|
95
|
+
def delete(feed, event)
|
96
96
|
logger.info("-- delete st --") if logger
|
97
97
|
auth unless @auth
|
98
98
|
uri = URI.parse(feed)
|
99
99
|
res = do_post(uri,
|
100
|
-
{"X-HTTP-Method-Override" => "DELETE"
|
101
|
-
"
|
100
|
+
{"X-HTTP-Method-Override" => "DELETE",
|
101
|
+
"Content-Type" => "application/atom+xml",
|
102
|
+
"Content-Length" => event.length.to_s}, event)
|
102
103
|
logger.info("-- delete en (#{res.message}) --") if logger
|
103
104
|
res
|
104
105
|
end
|
data/test/00_service_test.rb
CHANGED
data/test/03_authsub_test.rb
CHANGED
@@ -11,7 +11,7 @@ class TestService3 < Test::Unit::TestCase
|
|
11
11
|
SAMPLE_URL = "http://www.example.com/sample.html"
|
12
12
|
attr_accessor :logger
|
13
13
|
# get one-time token
|
14
|
-
def test_get_onetime_token
|
14
|
+
def test_get_onetime_token(use_session = false)
|
15
15
|
# login google account
|
16
16
|
agent = WWW::Mechanize.new do |a| a.log = logger end
|
17
17
|
page = agent.get("https://www.google.com/accounts/Login")
|
@@ -24,7 +24,6 @@ class TestService3 < Test::Unit::TestCase
|
|
24
24
|
# get auth sub request url
|
25
25
|
next_url = SAMPLE_URL
|
26
26
|
use_secure = false
|
27
|
-
use_session = true
|
28
27
|
request_url = GoogleCalendar::AuthSubUtil.build_request_url(
|
29
28
|
next_url, GoogleCalendar::AuthSubUtil::CALENDAR_SCOPE, use_secure, use_session)
|
30
29
|
query = "next=#{CGI.escape(next_url)}&scope=#{CGI.escape(GoogleCalendar::AuthSubUtil::CALENDAR_SCOPE)}&secure=#{use_secure ? "1" : "0"}&session=#{use_session ? "1" : "0"}"
|
@@ -53,7 +52,7 @@ class TestService3 < Test::Unit::TestCase
|
|
53
52
|
end
|
54
53
|
|
55
54
|
def test_use_session_token
|
56
|
-
one_time_token = test_get_onetime_token
|
55
|
+
one_time_token = test_get_onetime_token(true)
|
57
56
|
session_token = nil
|
58
57
|
srv = nil
|
59
58
|
begin
|
@@ -112,6 +111,29 @@ class TestService3 < Test::Unit::TestCase
|
|
112
111
|
end
|
113
112
|
end
|
114
113
|
end
|
114
|
+
|
115
|
+
def test_ensure_revoked
|
116
|
+
10.times do |n|
|
117
|
+
test_use_session_token do |token, srv|
|
118
|
+
ret = srv.query(FEED)
|
119
|
+
assert_equal("200", ret.code)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
=begin
|
125
|
+
def test_use_onetime_token
|
126
|
+
token = test_get_onetime_token(false)
|
127
|
+
srv = GoogleCalendar::ServiceAuthSub.new(token)
|
128
|
+
srv.logger = logger
|
129
|
+
ret = srv.query(FEED)
|
130
|
+
logger.debug(ret.body)
|
131
|
+
assert_equal("200", ret.code)
|
132
|
+
ret = srv.query(FEED)
|
133
|
+
logger.debug(ret.body)
|
134
|
+
assert_equal("401", ret.code)
|
135
|
+
end
|
136
|
+
=end
|
115
137
|
|
116
138
|
def setup
|
117
139
|
@logger = Logger.new("authsub.log")
|
data/test/base_unit.rb
CHANGED
@@ -8,9 +8,11 @@ require "logger"
|
|
8
8
|
module CalendarTest
|
9
9
|
include GoogleCalendar
|
10
10
|
def get_service
|
11
|
+
Service.proxy_addr = PROXY_ADDR if defined?(PROXY_ADDR)
|
12
|
+
Service.proxy_port = PROXY_PORT if defined?(PROXY_PORT)
|
11
13
|
srv = Service.new(MAIL, PASS)
|
12
14
|
srv.logger = Logger.new("testlog.log")
|
13
|
-
srv.logger.level = Logger::
|
15
|
+
srv.logger.level = Logger::DEBUG
|
14
16
|
assert_instance_of(Service, srv)
|
15
17
|
srv.send("auth")
|
16
18
|
assert_not_nil(srv.instance_eval("@auth"))
|
@@ -33,15 +35,8 @@ XML
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def clear_all(srv, feed)
|
36
|
-
|
37
|
-
|
38
|
-
ens.each do |entry|
|
39
|
-
entry.elements.each("link") do |link|
|
40
|
-
if link.attributes["rel"] == "edit"
|
41
|
-
@srv.delete(link.attributes["href"])
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
38
|
+
cal = Calendar.new(srv, feed)
|
39
|
+
cal.events.each do |elem| elem.destroy end
|
45
40
|
end
|
46
41
|
|
47
42
|
def get_entry_from_query(ret)
|
data/test/template.parameters.rb
CHANGED
metadata
CHANGED
@@ -1,52 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: gcalapi
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-02-18 00:00:00 +09:00
|
8
|
-
summary: Google Calendar API
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: zoriorz@gmail.com
|
12
|
-
homepage: http://gcalapi.rubyforge.net
|
13
|
-
rubyforge_project: gcalapi
|
14
|
-
description: ""
|
15
|
-
autorequire: googlecalendar/calendar
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.1.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- zorio
|
8
|
+
autorequire: googlecalendar/calendar
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-02-23 00:00:00 +09:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: ""
|
17
|
+
email: zoriorz@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
31
24
|
files:
|
32
25
|
- doc
|
33
|
-
- example
|
34
|
-
- html
|
35
|
-
- lib
|
36
|
-
- Rakefile
|
37
|
-
- README
|
38
|
-
- test
|
39
|
-
- VERSION
|
40
26
|
- doc/classes
|
41
|
-
- doc/files
|
42
27
|
- doc/classes/CalendarTest.src
|
43
28
|
- doc/classes/GoogleCalendar
|
44
|
-
- doc/classes/GoogleCalendar.src
|
45
|
-
- doc/classes/Mail.src
|
46
|
-
- doc/classes/TestCalendar1.src
|
47
|
-
- doc/classes/TestCalendar2.src
|
48
|
-
- doc/classes/TestService0.src
|
49
|
-
- doc/classes/TestService3.src
|
50
29
|
- doc/classes/GoogleCalendar/AuthSubFailed.src
|
51
30
|
- doc/classes/GoogleCalendar/AuthSubUtil.src
|
52
31
|
- doc/classes/GoogleCalendar/Calendar.src
|
@@ -54,24 +33,25 @@ files:
|
|
54
33
|
- doc/classes/GoogleCalendar/Service.src
|
55
34
|
- doc/classes/GoogleCalendar/ServiceAuthSub.src
|
56
35
|
- doc/classes/GoogleCalendar/ServiceBase.src
|
36
|
+
- doc/classes/GoogleCalendar.src
|
37
|
+
- doc/classes/Mail.src
|
38
|
+
- doc/classes/TestCalendar1.src
|
39
|
+
- doc/classes/TestCalendar2.src
|
40
|
+
- doc/classes/TestService0.src
|
41
|
+
- doc/classes/TestService3.src
|
42
|
+
- doc/files
|
57
43
|
- doc/files/example
|
58
|
-
- doc/files/lib
|
59
|
-
- doc/files/test
|
60
44
|
- doc/files/example/ol2gcal_rb.src
|
45
|
+
- doc/files/lib
|
61
46
|
- doc/files/lib/googlecalendar
|
47
|
+
- doc/files/test
|
48
|
+
- example
|
62
49
|
- example/mail2gcal.rb
|
63
50
|
- example/mixi2gcal.rb
|
64
51
|
- example/ol2gcal.rb
|
52
|
+
- html
|
65
53
|
- html/classes
|
66
|
-
- html/created.rid
|
67
|
-
- html/files
|
68
|
-
- html/fr_class_index.html
|
69
|
-
- html/fr_file_index.html
|
70
|
-
- html/fr_method_index.html
|
71
|
-
- html/index.html
|
72
|
-
- html/rdoc-style.css
|
73
54
|
- html/classes/GoogleCalendar
|
74
|
-
- html/classes/GoogleCalendar.html
|
75
55
|
- html/classes/GoogleCalendar/AuthenticationFailed.html
|
76
56
|
- html/classes/GoogleCalendar/AuthSubFailed.html
|
77
57
|
- html/classes/GoogleCalendar/AuthSubUtil.html
|
@@ -85,8 +65,10 @@ files:
|
|
85
65
|
- html/classes/GoogleCalendar/Service.html
|
86
66
|
- html/classes/GoogleCalendar/ServiceAuthSub.html
|
87
67
|
- html/classes/GoogleCalendar/ServiceBase.html
|
68
|
+
- html/classes/GoogleCalendar.html
|
69
|
+
- html/created.rid
|
70
|
+
- html/files
|
88
71
|
- html/files/lib
|
89
|
-
- html/files/README.html
|
90
72
|
- html/files/lib/googlecalendar
|
91
73
|
- html/files/lib/googlecalendar/auth_sub_util_rb.html
|
92
74
|
- html/files/lib/googlecalendar/calendar_rb.html
|
@@ -94,6 +76,13 @@ files:
|
|
94
76
|
- html/files/lib/googlecalendar/service_auth_sub_rb.html
|
95
77
|
- html/files/lib/googlecalendar/service_base_rb.html
|
96
78
|
- html/files/lib/googlecalendar/service_rb.html
|
79
|
+
- html/files/README.html
|
80
|
+
- html/fr_class_index.html
|
81
|
+
- html/fr_file_index.html
|
82
|
+
- html/fr_method_index.html
|
83
|
+
- html/index.html
|
84
|
+
- html/rdoc-style.css
|
85
|
+
- lib
|
97
86
|
- lib/gcalapi.rb
|
98
87
|
- lib/googlecalendar
|
99
88
|
- lib/googlecalendar/auth_sub_util.rb
|
@@ -102,6 +91,9 @@ files:
|
|
102
91
|
- lib/googlecalendar/service.rb
|
103
92
|
- lib/googlecalendar/service_auth_sub.rb
|
104
93
|
- lib/googlecalendar/service_base.rb
|
94
|
+
- Rakefile
|
95
|
+
- README
|
96
|
+
- test
|
105
97
|
- test/00_service_test.rb
|
106
98
|
- test/01_calendar_test.rb
|
107
99
|
- test/02_event_test.rb
|
@@ -110,21 +102,37 @@ files:
|
|
110
102
|
- test/base_unit.rb
|
111
103
|
- test/each.sh
|
112
104
|
- test/template.parameters.rb
|
113
|
-
|
114
|
-
-
|
115
|
-
|
116
|
-
|
117
|
-
|
105
|
+
- VERSION
|
106
|
+
- VERSION.BAK
|
107
|
+
has_rdoc: true
|
108
|
+
homepage: http://gcalapi.rubyforge.net
|
109
|
+
post_install_message:
|
118
110
|
rdoc_options:
|
119
111
|
- --line-numbers
|
120
112
|
- --inline-source
|
121
|
-
|
122
|
-
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: "0"
|
120
|
+
version:
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
version:
|
127
127
|
requirements: []
|
128
128
|
|
129
|
-
|
130
|
-
|
129
|
+
rubyforge_project: gcalapi
|
130
|
+
rubygems_version: 1.0.1
|
131
|
+
signing_key:
|
132
|
+
specification_version: 2
|
133
|
+
summary: Google Calendar API
|
134
|
+
test_files:
|
135
|
+
- test/00_service_test.rb
|
136
|
+
- test/01_calendar_test.rb
|
137
|
+
- test/02_event_test.rb
|
138
|
+
- test/03_authsub_test.rb
|