TwitRuby 0.0.1 → 0.0.12
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.
- checksums.yaml +4 -4
- data/README.md +39 -19
- data/doc/TwitRuby.html +91 -36
- data/doc/created.rid +2 -2
- data/doc/index.html +1 -2
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +9 -2
- data/lib/twitruby/version.rb +1 -1
- metadata +1 -3
- data/lib/twitruby/version.rb~ +0 -2
- data/lib/twitruby.rb~ +0 -371
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b79e8c70f3ad5343361b1b4de7feb2e24b9ad02
|
4
|
+
data.tar.gz: ed21e14576084be23561c62d63c1d4e56cb93b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f86aa4c8c4c0f5298f371ddf5c6d8c84712a0688b53e5ba31946a42e5bedbe9f340ab777ee4b7e9dd95d5bb7711b3fc5ce01237bb34e93c123e6295d9283574
|
7
|
+
data.tar.gz: 7f775cab9b7ad33b5fd77179b7d37b9e295c07c0d0dbb9f30029998b130ad6158de30bde417b8fa53941467c57670f87d5cc5e97c49749fecb5719b8a98d21b2
|
data/README.md
CHANGED
@@ -1,25 +1,45 @@
|
|
1
|
-
# Twitruby
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# Twitruby
|
2
|
+
########################################################################
|
3
|
+
# ==TwitRuby== #
|
4
|
+
# Copyright (C) alphaKAI @alpha_kai_NET 2013 http://alpha-kai-net.info #
|
5
|
+
# GPLv3 LICENSE #
|
6
|
+
# #
|
7
|
+
# Version:0.0.1_alpha FIX05 #
|
8
|
+
# This is one of the Twitter Library #
|
9
|
+
# inspired by https://gist.github.com/pnlybubbles/5476370 #
|
10
|
+
# This is development version. #
|
11
|
+
# So very unstable. #
|
12
|
+
# You must accept it when you use this. #
|
13
|
+
########################################################################
|
14
|
+
|
15
|
+
|
5
16
|
## Installation
|
6
|
-
|
17
|
+
|
7
18
|
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'twitruby'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install twitruby
|
18
|
-
|
19
|
+
|
20
|
+
gem 'twitruby'
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install twitruby
|
29
|
+
|
30
|
+
|
19
31
|
## Usage
|
20
|
-
|
21
|
-
|
22
|
-
|
32
|
+
You shude look func_sample.rb
|
33
|
+
|
34
|
+
|
35
|
+
## Author web sites
|
36
|
+
Blog <http://blog.alpha-kai-net.info>
|
37
|
+
HP <http://alpha-kai-net.info>
|
38
|
+
Twitter <http://twitter.com/alpha_kai_NET>
|
39
|
+
Github <https://github.com/alphaKAI>
|
40
|
+
Mail to <alpha.kai.net@alpha-kai-net.info>
|
41
|
+
|
42
|
+
|
23
43
|
## Contributing
|
24
44
|
|
25
45
|
1. Fork it
|
data/doc/TwitRuby.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
6
|
|
7
|
-
<title>class TwitRuby -
|
7
|
+
<title>class TwitRuby - TwitRuby document</title>
|
8
8
|
|
9
9
|
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
10
|
|
@@ -85,6 +85,8 @@
|
|
85
85
|
|
86
86
|
<li ><a href="#method-i-friendships-3F">#friendships?</a>
|
87
87
|
|
88
|
+
<li ><a href="#method-i-gen_parms">#gen_parms</a>
|
89
|
+
|
88
90
|
<li ><a href="#method-i-get_rate_limit">#get_rate_limit</a>
|
89
91
|
|
90
92
|
<li ><a href="#method-i-get_rom">#get_rom</a>
|
@@ -146,6 +148,22 @@
|
|
146
148
|
|
147
149
|
<div id="description" class="description">
|
148
150
|
|
151
|
+
<h2 id="label-TwitRuby%3D%3D+++++++++++++++++++++++++++++++++++++++++++++++++++++++++%23">TwitRuby== #<span><a href="#label-TwitRuby%3D%3D+++++++++++++++++++++++++++++++++++++++++++++++++++++++++%23">¶</a> <a href="#documentation">↑</a></span></h2>
|
152
|
+
|
153
|
+
<p>Copyright (C) alphaKAI @alpha_kai_NET 2013 <a
|
154
|
+
href="http://alpha-kai-net.info">alpha-kai-net.info</a> # GPLv3 LICENSE
|
155
|
+
#</p>
|
156
|
+
|
157
|
+
<pre>#</pre>
|
158
|
+
|
159
|
+
<p>Version:0.0.1_alpha FIX05 # This
|
160
|
+
is one of the Twitter Library # inspired
|
161
|
+
by <a
|
162
|
+
href="https://gist.github.com/pnlybubbles/5476370">gist.github.com/pnlybubbles/5476370</a>
|
163
|
+
# This is development version. # So
|
164
|
+
very unstable. # You
|
165
|
+
must accept it when you use this. #</p>
|
166
|
+
|
149
167
|
</div><!-- description -->
|
150
168
|
|
151
169
|
|
@@ -185,7 +203,7 @@
|
|
185
203
|
|
186
204
|
|
187
205
|
<div class="method-source-code" id="dm_msgs-source">
|
188
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
206
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 227</span>
|
189
207
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dm_msgs</span>(<span class="ruby-identifier">since_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">max_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">count</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_entities</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">skip_status</span>=<span class="ruby-string">""</span>)
|
190
208
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/direct_messages.json"</span>,
|
191
209
|
<span class="ruby-string">"since_id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">since_id</span>,
|
@@ -224,7 +242,7 @@
|
|
224
242
|
|
225
243
|
|
226
244
|
<div class="method-source-code" id="dm_send-source">
|
227
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
245
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 201</span>
|
228
246
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dm_send</span>(<span class="ruby-identifier">user_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">screen_name</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">text</span>)
|
229
247
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">user_id</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">then</span>
|
230
248
|
<span class="ruby-keyword">return</span> <span class="ruby-string">"Error. user_id => empty"</span>
|
@@ -263,7 +281,7 @@
|
|
263
281
|
|
264
282
|
|
265
283
|
<div class="method-source-code" id="favorite-source">
|
266
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
284
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 106</span>
|
267
285
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">favorite</span>(<span class="ruby-identifier">id</span>)
|
268
286
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-string">"/1.1/favorites/create.json"</span>,
|
269
287
|
<span class="ruby-string">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span>)
|
@@ -297,7 +315,7 @@
|
|
297
315
|
|
298
316
|
|
299
317
|
<div class="method-source-code" id="follow-source">
|
300
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
318
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 133</span>
|
301
319
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">follow</span>(<span class="ruby-identifier">screen_name</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">user_id</span>=<span class="ruby-string">""</span>)
|
302
320
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-string">"/1.1/friendships/create.json"</span>,
|
303
321
|
<span class="ruby-string">"screen_name"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">screen_name</span>,
|
@@ -333,7 +351,7 @@
|
|
333
351
|
|
334
352
|
|
335
353
|
<div class="method-source-code" id="follower_ids-source">
|
336
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
354
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 247</span>
|
337
355
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">follower_ids</span>(<span class="ruby-identifier">user_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">screen_name</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">cursor</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">stringify_ids</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">count</span>=<span class="ruby-string">""</span>)
|
338
356
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/followers/ids.json"</span>,
|
339
357
|
<span class="ruby-string">"user_id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user_id</span>,
|
@@ -372,7 +390,7 @@
|
|
372
390
|
|
373
391
|
|
374
392
|
<div class="method-source-code" id="friendships-3F-source">
|
375
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
393
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 283</span>
|
376
394
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">friendships?</span>(<span class="ruby-identifier">source_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">source_screen_name</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">target_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">target_screen_name</span>=<span class="ruby-string">""</span>)
|
377
395
|
|
378
396
|
<span class="ruby-comment">#Convert and Build</span>
|
@@ -408,6 +426,44 @@
|
|
408
426
|
</div><!-- friendships-3F-method -->
|
409
427
|
|
410
428
|
|
429
|
+
<div id="method-i-gen_parms" class="method-detail ">
|
430
|
+
|
431
|
+
<div class="method-heading">
|
432
|
+
<span class="method-name">gen_parms</span><span
|
433
|
+
class="method-args">(api,parms)</span>
|
434
|
+
|
435
|
+
<span class="method-click-advice">click to toggle source</span>
|
436
|
+
|
437
|
+
</div>
|
438
|
+
|
439
|
+
|
440
|
+
<div class="method-description">
|
441
|
+
|
442
|
+
<p>Generate api parameters function</p>
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
<div class="method-source-code" id="gen_parms-source">
|
448
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 83</span>
|
449
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">gen_parms</span>(<span class="ruby-identifier">api</span>,<span class="ruby-identifier">parms</span>)
|
450
|
+
<span class="ruby-identifier">hash_str</span>=<span class="ruby-string">"?"</span>
|
451
|
+
<span class="ruby-identifier">parms</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
452
|
+
<span class="ruby-identifier">hash_str</span><span class="ruby-operator">+=</span><span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-string">"="</span><span class="ruby-operator">+</span><span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">+</span><span class="ruby-string">"&"</span>
|
453
|
+
}
|
454
|
+
<span class="ruby-identifier">hash_str</span>[<span class="ruby-identifier">hash_str</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]=<span class="ruby-string">""</span>
|
455
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">hash_str</span>.<span class="ruby-identifier">chomp</span>
|
456
|
+
<span class="ruby-keyword">end</span></pre>
|
457
|
+
</div><!-- gen_parms-source -->
|
458
|
+
|
459
|
+
</div>
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
</div><!-- gen_parms-method -->
|
465
|
+
|
466
|
+
|
411
467
|
<div id="method-i-get_rate_limit" class="method-detail ">
|
412
468
|
|
413
469
|
<div class="method-heading">
|
@@ -427,7 +483,7 @@
|
|
427
483
|
|
428
484
|
|
429
485
|
<div class="method-source-code" id="get_rate_limit-source">
|
430
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
486
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 278</span>
|
431
487
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_rate_limit</span>
|
432
488
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>((<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/application/rate_limit_status.json"</span>)).<span class="ruby-identifier">body</span>)
|
433
489
|
<span class="ruby-keyword">end</span></pre>
|
@@ -460,7 +516,7 @@
|
|
460
516
|
|
461
517
|
|
462
518
|
<div class="method-source-code" id="get_rom-source">
|
463
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
519
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 187</span>
|
464
520
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_rom</span>(<span class="ruby-identifier">count</span>,<span class="ruby-identifier">since_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">max_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">trim_user</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_entities</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_user_entities</span>=<span class="ruby-string">""</span>)
|
465
521
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/statuses/retweets_of_me.json"</span>,
|
466
522
|
<span class="ruby-string">"count"</span> =<span class="ruby-operator">></span><span class="ruby-identifier">count</span>,
|
@@ -500,17 +556,17 @@
|
|
500
556
|
|
501
557
|
|
502
558
|
<div class="method-source-code" id="get_sent_dm-source">
|
503
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
559
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 212</span>
|
504
560
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_sent_dm</span>(<span class="ruby-identifier">since_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">max_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">count</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">page</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_entities</span>=<span class="ruby-string">""</span>)
|
505
561
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">since_id</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">max_id</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">include_entities</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">then</span>
|
506
562
|
<span class="ruby-keyword">return</span> <span class="ruby-string">"Error. same parms is empty"</span>
|
507
563
|
<span class="ruby-keyword">end</span>
|
508
564
|
|
509
565
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/direct_messages/sent.json"</span>,
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
566
|
+
<span class="ruby-string">"since_id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">since_id</span>,
|
567
|
+
<span class="ruby-string">"max_id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">max_id</span>,
|
568
|
+
<span class="ruby-string">"count"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">count</span>,
|
569
|
+
<span class="ruby-string">"page"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">page</span>,
|
514
570
|
<span class="ruby-string">"include_entities"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">include_entities</span>,
|
515
571
|
).<span class="ruby-identifier">body</span>)
|
516
572
|
<span class="ruby-keyword">end</span></pre>
|
@@ -543,7 +599,7 @@
|
|
543
599
|
|
544
600
|
|
545
601
|
<div class="method-source-code" id="home_timeline-source">
|
546
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
602
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 160</span>
|
547
603
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">home_timeline</span>(<span class="ruby-identifier">count</span>,<span class="ruby-identifier">since_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">max_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">trim_user</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_entities</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_user_entities</span>=<span class="ruby-string">""</span>)
|
548
604
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/statuses/home_timeline.json"</span>,
|
549
605
|
<span class="ruby-string">"count"</span> =<span class="ruby-operator">></span><span class="ruby-identifier">count</span>,
|
@@ -583,7 +639,7 @@
|
|
583
639
|
|
584
640
|
|
585
641
|
<div class="method-source-code" id="initalize_connection-source">
|
586
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
642
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 16</span>
|
587
643
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initalize_connection</span>(<span class="ruby-identifier">consumer_keys</span>)
|
588
644
|
<span class="ruby-identifier">ak_exist</span>=<span class="ruby-keyword">true</span>
|
589
645
|
<span class="ruby-comment">#デフォ状態での引数にアクセストークン系があるかないか 初期になかった場合は処理中にfalseに変更</span>
|
@@ -612,8 +668,8 @@
|
|
612
668
|
<span class="ruby-identifier">ak_exist</span> = <span class="ruby-keyword">false</span>
|
613
669
|
<span class="ruby-keyword">end</span>
|
614
670
|
|
615
|
-
<span class="ruby-comment">#
|
616
|
-
<span class="ruby-comment">#
|
671
|
+
<span class="ruby-comment">#puts access_token</span>
|
672
|
+
<span class="ruby-comment">#puts access_token_secret</span>
|
617
673
|
|
618
674
|
<span class="ruby-ivar">@access_token</span> = <span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessToken</span>.<span class="ruby-identifier">new</span>(
|
619
675
|
<span class="ruby-ivar">@consumer</span>,
|
@@ -650,7 +706,7 @@
|
|
650
706
|
|
651
707
|
|
652
708
|
<div class="method-source-code" id="mentions_timeline-source">
|
653
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
709
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 148</span>
|
654
710
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">mentions_timeline</span>(<span class="ruby-identifier">count</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">since_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">max_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">trim_user</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">contributor_details</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_entities</span>=<span class="ruby-string">""</span>)
|
655
711
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>((<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/statuses/mentions_timeline.json"</span>,
|
656
712
|
<span class="ruby-string">"count"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">count</span>,
|
@@ -690,7 +746,7 @@
|
|
690
746
|
|
691
747
|
|
692
748
|
<div class="method-source-code" id="oauth_init-source">
|
693
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
749
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 54</span>
|
694
750
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">oauth_init</span>
|
695
751
|
<span class="ruby-keyword">begin</span>
|
696
752
|
<span class="ruby-identifier">request_token</span> = <span class="ruby-ivar">@consumer</span>.<span class="ruby-identifier">get_request_token</span>
|
@@ -706,8 +762,8 @@
|
|
706
762
|
<span class="ruby-identifier">puts</span> <span class="ruby-string">""</span><span class="ruby-comment">#改行</span>
|
707
763
|
|
708
764
|
<span class="ruby-identifier">access_token</span> = <span class="ruby-identifier">request_token</span>.<span class="ruby-identifier">get_access_token</span>(
|
709
|
-
<span class="ruby-
|
710
|
-
<span class="ruby-
|
765
|
+
<span class="ruby-value">:oauth_token</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">request_token</span>.<span class="ruby-identifier">token</span>,
|
766
|
+
<span class="ruby-value">:oauth_verifier</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">pin</span>
|
711
767
|
)
|
712
768
|
|
713
769
|
<span class="ruby-identifier">access_tokens</span> = []
|
@@ -746,7 +802,7 @@
|
|
746
802
|
|
747
803
|
|
748
804
|
<div class="method-source-code" id="post_delete-source">
|
749
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
805
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 123</span>
|
750
806
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">post_delete</span>(<span class="ruby-identifier">id</span>)
|
751
807
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-node">"/1.1/statuses/destroy/#{id}.json"</span>)
|
752
808
|
<span class="ruby-keyword">end</span></pre>
|
@@ -779,7 +835,7 @@
|
|
779
835
|
|
780
836
|
|
781
837
|
<div class="method-source-code" id="post_dm_destory-source">
|
782
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
838
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 238</span>
|
783
839
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">post_dm_destory</span>(<span class="ruby-identifier">id</span>,<span class="ruby-identifier">include_entities</span>=<span class="ruby-string">""</span>)
|
784
840
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-string">"/1.1/direct_messages/destroy.json"</span>,
|
785
841
|
<span class="ruby-string">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">id</span>,
|
@@ -814,15 +870,14 @@
|
|
814
870
|
|
815
871
|
|
816
872
|
<div class="method-source-code" id="public_sample-source">
|
817
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
873
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 343</span>
|
818
874
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">public_sample</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
819
875
|
<span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">"https://stream.twitter.com/1.1/statuses/sample.json"</span>)
|
820
876
|
<span class="ruby-identifier">https</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</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>)
|
821
877
|
<span class="ruby-identifier">https</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword">true</span>
|
822
878
|
<span class="ruby-identifier">https</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span>
|
823
|
-
|
824
|
-
|
825
|
-
<span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>)
|
879
|
+
<span class="ruby-identifier">https</span>.<span class="ruby-identifier">start</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">https</span><span class="ruby-operator">|</span>
|
880
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span><span class="ruby-operator">+</span><span class="ruby-string">"track=twitter"</span>)
|
826
881
|
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">oauth!</span>(<span class="ruby-identifier">https</span>, <span class="ruby-ivar">@consumer</span>, <span class="ruby-ivar">@access_token</span>)
|
827
882
|
<span class="ruby-identifier">buf</span> = <span class="ruby-string">""</span>
|
828
883
|
<span class="ruby-identifier">https</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
|
@@ -871,7 +926,7 @@
|
|
871
926
|
|
872
927
|
|
873
928
|
<div class="method-source-code" id="remove-source">
|
874
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
929
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 141</span>
|
875
930
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">screen_name</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">user_id</span>=<span class="ruby-string">""</span>)
|
876
931
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-string">"/1.1/friendships/destroy.json"</span>,
|
877
932
|
<span class="ruby-string">"screen_name"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">screen_name</span>,
|
@@ -906,7 +961,7 @@
|
|
906
961
|
|
907
962
|
|
908
963
|
<div class="method-source-code" id="retweet-source">
|
909
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
964
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 118</span>
|
910
965
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">retweet</span>(<span class="ruby-identifier">id</span>)
|
911
966
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-node">"/1.1/statuses/retweet/#{id}.json"</span>)
|
912
967
|
<span class="ruby-keyword">end</span></pre>
|
@@ -939,7 +994,7 @@
|
|
939
994
|
|
940
995
|
|
941
996
|
<div class="method-source-code" id="unfavorite-source">
|
942
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
997
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 112</span>
|
943
998
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unfavorite</span>(<span class="ruby-identifier">id</span>)
|
944
999
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-string">"/1.1/favorites/destroy.json"</span>,
|
945
1000
|
<span class="ruby-string">"id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span>)
|
@@ -973,7 +1028,7 @@
|
|
973
1028
|
|
974
1029
|
|
975
1030
|
<div class="method-source-code" id="update-source">
|
976
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
1031
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 94</span>
|
977
1032
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">id</span>=<span class="ruby-string">""</span>)
|
978
1033
|
<span class="ruby-keyword">if</span> (<span class="ruby-identifier">id</span>.<span class="ruby-identifier">empty?</span>) <span class="ruby-keyword">then</span>
|
979
1034
|
<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">post</span>(<span class="ruby-string">"/1.1/statuses/update.json"</span>,
|
@@ -1013,7 +1068,7 @@
|
|
1013
1068
|
|
1014
1069
|
|
1015
1070
|
<div class="method-source-code" id="user_ava-3F-source">
|
1016
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
1071
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 259</span>
|
1017
1072
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">user_ava?</span>(<span class="ruby-identifier">user_name</span>)
|
1018
1073
|
|
1019
1074
|
<span class="ruby-comment">#for https</span>
|
@@ -1060,7 +1115,7 @@
|
|
1060
1115
|
|
1061
1116
|
|
1062
1117
|
<div class="method-source-code" id="user_stream-source">
|
1063
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
1118
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 314</span>
|
1064
1119
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">user_stream</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1065
1120
|
<span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">"https://userstream.twitter.com/1.1/user.json"</span>)
|
1066
1121
|
<span class="ruby-identifier">https</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</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>)
|
@@ -1117,7 +1172,7 @@
|
|
1117
1172
|
|
1118
1173
|
|
1119
1174
|
<div class="method-source-code" id="user_timeline-source">
|
1120
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
1175
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 172</span>
|
1121
1176
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">user_timeline</span>(<span class="ruby-identifier">user_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">screen_name</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">since_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">count</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">max_id</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">trim_user</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">exclude_replies</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">contributor_details</span>=<span class="ruby-string">""</span>,<span class="ruby-identifier">include_rts</span>=<span class="ruby-string">""</span>)
|
1122
1177
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/statuses/user_timeline.json"</span>,
|
1123
1178
|
<span class="ruby-string">"user_id"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">user_id</span>,
|
@@ -1160,7 +1215,7 @@
|
|
1160
1215
|
|
1161
1216
|
|
1162
1217
|
<div class="method-source-code" id="verify_credentials-source">
|
1163
|
-
<pre><span class="ruby-comment"># File lib/twitruby.rb, line
|
1218
|
+
<pre><span class="ruby-comment"># File lib/twitruby.rb, line 128</span>
|
1164
1219
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">verify_credentials</span>
|
1165
1220
|
<span class="ruby-keyword">return</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@access_token</span>.<span class="ruby-identifier">get</span>(<span class="ruby-string">"/1.1/account/verify_credentials.json"</span>).<span class="ruby-identifier">body</span>)
|
1166
1221
|
<span class="ruby-keyword">end</span></pre>
|
data/doc/created.rid
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
lib/twitruby.rb
|
1
|
+
Tue, 13 Aug 2013 14:51:37 +0900
|
2
|
+
lib/twitruby.rb Tue, 13 Aug 2013 14:42:39 +0900
|
data/doc/index.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
6
|
|
7
|
-
<title>
|
7
|
+
<title>TwitRuby document</title>
|
8
8
|
|
9
9
|
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
10
|
|
@@ -59,7 +59,6 @@
|
|
59
59
|
</nav>
|
60
60
|
|
61
61
|
<div id="documentation" class="description">
|
62
|
-
<p>This is the API documentation for RDoc Documentation.
|
63
62
|
</div>
|
64
63
|
|
65
64
|
|
data/doc/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["twitruby","dm_msgs()","dm_send()","favorite()","follow()","follower_ids()","friendships?()","get_rate_limit()","get_rom()","get_sent_dm()","home_timeline()","initalize_connection()","mentions_timeline()","oauth_init()","post_delete()","post_dm_destory()","public_sample()","remove()","retweet()","unfavorite()","update()","user_ava?()","user_stream()","user_timeline()","verify_credentials()"],"longSearchIndex":["twitruby","twitruby#dm_msgs()","twitruby#dm_send()","twitruby#favorite()","twitruby#follow()","twitruby#follower_ids()","twitruby#friendships?()","twitruby#get_rate_limit()","twitruby#get_rom()","twitruby#get_sent_dm()","twitruby#home_timeline()","twitruby#initalize_connection()","twitruby#mentions_timeline()","twitruby#oauth_init()","twitruby#post_delete()","twitruby#post_dm_destory()","twitruby#public_sample()","twitruby#remove()","twitruby#retweet()","twitruby#unfavorite()","twitruby#update()","twitruby#user_ava?()","twitruby#user_stream()","twitruby#user_timeline()","twitruby#verify_credentials()"],"info":[["TwitRuby","","TwitRuby.html","",""],["dm_msgs","TwitRuby","TwitRuby.html#method-i-dm_msgs","(since_id=\"\",max_id=\"\",count=\"\",include_entities=\"\",skip_status=\"\")","<p>GET direct_messages\n"],["dm_send","TwitRuby","TwitRuby.html#method-i-dm_send","(user_id=\"\",screen_name=\"\",text)","<p>POST direct_messages/new\n"],["favorite","TwitRuby","TwitRuby.html#method-i-favorite","(id)","<p>POST favorites/create\n"],["follow","TwitRuby","TwitRuby.html#method-i-follow","(screen_name=\"\",user_id=\"\")","<p>POST friendships/create\n"],["follower_ids","TwitRuby","TwitRuby.html#method-i-follower_ids","(user_id=\"\",screen_name=\"\",cursor=\"\",stringify_ids=\"\",count=\"\")","<p>GET followers/ids\n"],["friendships?","TwitRuby","TwitRuby.html#method-i-friendships-3F","(source_id=\"\",source_screen_name=\"\",target_id=\"\",target_screen_name=\"\")","<p>GET friendships/show\n"],["get_rate_limit","TwitRuby","TwitRuby.html#method-i-get_rate_limit","()","<p>GET account/rate_limit_status\n"],["get_rom","TwitRuby","TwitRuby.html#method-i-get_rom","(count,since_id=\"\",max_id=\"\",trim_user=\"\",include_entities=\"\",include_user_entities=\"\")","<p>GET statuses/retweets_of_me\n"],["get_sent_dm","TwitRuby","TwitRuby.html#method-i-get_sent_dm","(since_id=\"\",max_id=\"\",count=\"\",page=\"\",include_entities=\"\")","<p>GET direct_messages/sent\n"],["home_timeline","TwitRuby","TwitRuby.html#method-i-home_timeline","(count,since_id=\"\",max_id=\"\",trim_user=\"\",include_entities=\"\",include_user_entities=\"\")","<p>GET statuses/home_timeline\n"],["initalize_connection","TwitRuby","TwitRuby.html#method-i-initalize_connection","(consumer_keys)",""],["mentions_timeline","TwitRuby","TwitRuby.html#method-i-mentions_timeline","(count=\"\",since_id=\"\",max_id=\"\",trim_user=\"\",contributor_details=\"\",include_entities=\"\")","<p>GET statuses/mentions_timeline\n"],["oauth_init","TwitRuby","TwitRuby.html#method-i-oauth_init","()",""],["post_delete","TwitRuby","TwitRuby.html#method-i-post_delete","(id)","<p>POST statuses/destroy\n"],["post_dm_destory","TwitRuby","TwitRuby.html#method-i-post_dm_destory","(id,include_entities=\"\")","<p>POST direct_messages/destroy\n"],["public_sample","TwitRuby","TwitRuby.html#method-i-public_sample","(&block)","<p>Public Sample\n"],["remove","TwitRuby","TwitRuby.html#method-i-remove","(screen_name=\"\",user_id=\"\")","<p>POST friendships/destroy\n"],["retweet","TwitRuby","TwitRuby.html#method-i-retweet","(id)","<p>POST statuses/retweet\n"],["unfavorite","TwitRuby","TwitRuby.html#method-i-unfavorite","(id)","<p>POST favorites/destroy\n"],["update","TwitRuby","TwitRuby.html#method-i-update","(str, id=\"\")","<p>POST statuses/update\n"],["user_ava?","TwitRuby","TwitRuby.html#method-i-user_ava-3F","(user_name)","<p>GET username_available? 存在確認なので真偽値は逆となる trueなら使用可(IDとして新規作成時に)\n"],["user_stream","TwitRuby","TwitRuby.html#method-i-user_stream","(&block)","<p>UserStream\n"],["user_timeline","TwitRuby","TwitRuby.html#method-i-user_timeline","(user_id=\"\",screen_name=\"\",since_id=\"\",count=\"\",max_id=\"\",trim_user=\"\",exclude_replies=\"\",contributor_details=\"\",include_rts=\"\")","<p>GET statuses/user_timeline\n"],["verify_credentials","TwitRuby","TwitRuby.html#method-i-verify_credentials","()","<p>GET account/verify_credentials\n"]]}}
|
1
|
+
var search_data = {"index":{"searchIndex":["twitruby","dm_msgs()","dm_send()","favorite()","follow()","follower_ids()","friendships?()","gen_parms()","get_rate_limit()","get_rom()","get_sent_dm()","home_timeline()","initalize_connection()","mentions_timeline()","oauth_init()","post_delete()","post_dm_destory()","public_sample()","remove()","retweet()","unfavorite()","update()","user_ava?()","user_stream()","user_timeline()","verify_credentials()"],"longSearchIndex":["twitruby","twitruby#dm_msgs()","twitruby#dm_send()","twitruby#favorite()","twitruby#follow()","twitruby#follower_ids()","twitruby#friendships?()","twitruby#gen_parms()","twitruby#get_rate_limit()","twitruby#get_rom()","twitruby#get_sent_dm()","twitruby#home_timeline()","twitruby#initalize_connection()","twitruby#mentions_timeline()","twitruby#oauth_init()","twitruby#post_delete()","twitruby#post_dm_destory()","twitruby#public_sample()","twitruby#remove()","twitruby#retweet()","twitruby#unfavorite()","twitruby#update()","twitruby#user_ava?()","twitruby#user_stream()","twitruby#user_timeline()","twitruby#verify_credentials()"],"info":[["TwitRuby","","TwitRuby.html","","<p>TwitRuby== #\n<p>Copyright (C) alphaKAI @alpha_kai_NET …\n"],["dm_msgs","TwitRuby","TwitRuby.html#method-i-dm_msgs","(since_id=\"\",max_id=\"\",count=\"\",include_entities=\"\",skip_status=\"\")","<p>GET direct_messages\n"],["dm_send","TwitRuby","TwitRuby.html#method-i-dm_send","(user_id=\"\",screen_name=\"\",text)","<p>POST direct_messages/new\n"],["favorite","TwitRuby","TwitRuby.html#method-i-favorite","(id)","<p>POST favorites/create\n"],["follow","TwitRuby","TwitRuby.html#method-i-follow","(screen_name=\"\",user_id=\"\")","<p>POST friendships/create\n"],["follower_ids","TwitRuby","TwitRuby.html#method-i-follower_ids","(user_id=\"\",screen_name=\"\",cursor=\"\",stringify_ids=\"\",count=\"\")","<p>GET followers/ids\n"],["friendships?","TwitRuby","TwitRuby.html#method-i-friendships-3F","(source_id=\"\",source_screen_name=\"\",target_id=\"\",target_screen_name=\"\")","<p>GET friendships/show\n"],["gen_parms","TwitRuby","TwitRuby.html#method-i-gen_parms","(api,parms)","<p>Generate api parameters function\n"],["get_rate_limit","TwitRuby","TwitRuby.html#method-i-get_rate_limit","()","<p>GET account/rate_limit_status\n"],["get_rom","TwitRuby","TwitRuby.html#method-i-get_rom","(count,since_id=\"\",max_id=\"\",trim_user=\"\",include_entities=\"\",include_user_entities=\"\")","<p>GET statuses/retweets_of_me\n"],["get_sent_dm","TwitRuby","TwitRuby.html#method-i-get_sent_dm","(since_id=\"\",max_id=\"\",count=\"\",page=\"\",include_entities=\"\")","<p>GET direct_messages/sent\n"],["home_timeline","TwitRuby","TwitRuby.html#method-i-home_timeline","(count,since_id=\"\",max_id=\"\",trim_user=\"\",include_entities=\"\",include_user_entities=\"\")","<p>GET statuses/home_timeline\n"],["initalize_connection","TwitRuby","TwitRuby.html#method-i-initalize_connection","(consumer_keys)",""],["mentions_timeline","TwitRuby","TwitRuby.html#method-i-mentions_timeline","(count=\"\",since_id=\"\",max_id=\"\",trim_user=\"\",contributor_details=\"\",include_entities=\"\")","<p>GET statuses/mentions_timeline\n"],["oauth_init","TwitRuby","TwitRuby.html#method-i-oauth_init","()",""],["post_delete","TwitRuby","TwitRuby.html#method-i-post_delete","(id)","<p>POST statuses/destroy\n"],["post_dm_destory","TwitRuby","TwitRuby.html#method-i-post_dm_destory","(id,include_entities=\"\")","<p>POST direct_messages/destroy\n"],["public_sample","TwitRuby","TwitRuby.html#method-i-public_sample","(&block)","<p>Public Sample\n"],["remove","TwitRuby","TwitRuby.html#method-i-remove","(screen_name=\"\",user_id=\"\")","<p>POST friendships/destroy\n"],["retweet","TwitRuby","TwitRuby.html#method-i-retweet","(id)","<p>POST statuses/retweet\n"],["unfavorite","TwitRuby","TwitRuby.html#method-i-unfavorite","(id)","<p>POST favorites/destroy\n"],["update","TwitRuby","TwitRuby.html#method-i-update","(str, id=\"\")","<p>POST statuses/update\n"],["user_ava?","TwitRuby","TwitRuby.html#method-i-user_ava-3F","(user_name)","<p>GET username_available? 存在確認なので真偽値は逆となる trueなら使用可(IDとして新規作成時に)\n"],["user_stream","TwitRuby","TwitRuby.html#method-i-user_stream","(&block)","<p>UserStream\n"],["user_timeline","TwitRuby","TwitRuby.html#method-i-user_timeline","(user_id=\"\",screen_name=\"\",since_id=\"\",count=\"\",max_id=\"\",trim_user=\"\",exclude_replies=\"\",contributor_details=\"\",include_rts=\"\")","<p>GET statuses/user_timeline\n"],["verify_credentials","TwitRuby","TwitRuby.html#method-i-verify_credentials","()","<p>GET account/verify_credentials\n"]]}}
|
data/doc/table_of_contents.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
6
|
|
7
|
-
<title>Table of Contents -
|
7
|
+
<title>Table of Contents - TwitRuby document</title>
|
8
8
|
|
9
9
|
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
10
|
|
@@ -21,13 +21,18 @@
|
|
21
21
|
|
22
22
|
|
23
23
|
<body class="indexpage">
|
24
|
-
<h1>Table of Contents -
|
24
|
+
<h1>Table of Contents - TwitRuby document</h1>
|
25
25
|
|
26
26
|
|
27
27
|
<h2 id="classes">Classes/Modules</h2>
|
28
28
|
<ul>
|
29
29
|
<li class="class">
|
30
30
|
<a href="TwitRuby.html">TwitRuby</a>
|
31
|
+
|
32
|
+
<img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
|
33
|
+
<ul class="initially-hidden">
|
34
|
+
<li><a href="TwitRuby.html#label-TwitRuby%3D%3D+++++++++++++++++++++++++++++++++++++++++++++++++++++++++%23">TwitRuby== #</a>
|
35
|
+
</ul>
|
31
36
|
</li>
|
32
37
|
|
33
38
|
</ul>
|
@@ -47,6 +52,8 @@
|
|
47
52
|
|
48
53
|
<li class="method"><a href="TwitRuby.html#method-i-friendships-3F">#friendships? — TwitRuby</a>
|
49
54
|
|
55
|
+
<li class="method"><a href="TwitRuby.html#method-i-gen_parms">#gen_parms — TwitRuby</a>
|
56
|
+
|
50
57
|
<li class="method"><a href="TwitRuby.html#method-i-get_rate_limit">#get_rate_limit — TwitRuby</a>
|
51
58
|
|
52
59
|
<li class="method"><a href="TwitRuby.html#method-i-get_rom">#get_rom — TwitRuby</a>
|
data/lib/twitruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: TwitRuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alphaKAI
|
@@ -88,9 +88,7 @@ files:
|
|
88
88
|
- doc/table_of_contents.html
|
89
89
|
- lib/func_sample.rb
|
90
90
|
- lib/twitruby.rb
|
91
|
-
- lib/twitruby.rb~
|
92
91
|
- lib/twitruby/version.rb
|
93
|
-
- lib/twitruby/version.rb~
|
94
92
|
- twitruby.gemspec
|
95
93
|
homepage: http://alpha-kai-net.info
|
96
94
|
licenses:
|
data/lib/twitruby/version.rb~
DELETED
data/lib/twitruby.rb~
DELETED
@@ -1,371 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "twitruby/version"
|
3
|
-
|
4
|
-
########################################################################
|
5
|
-
# ==TwitRuby== #
|
6
|
-
# Copyright (C) alphaKAI @alpha_kai_NET 2013 http://alpha-kai-net.info #
|
7
|
-
# GPLv3 LICENSE #
|
8
|
-
# #
|
9
|
-
# Version:0.0.1_alpha FIX05 #
|
10
|
-
# This is one of the Twitter Library #
|
11
|
-
# inspired by https://gist.github.com/pnlybubbles/5476370 #
|
12
|
-
# This is development version. #
|
13
|
-
# So very unstable. #
|
14
|
-
# You must accept it when you use this. #
|
15
|
-
########################################################################
|
16
|
-
class TwitRuby
|
17
|
-
def initalize_connection(consumer_keys)
|
18
|
-
ak_exist=true
|
19
|
-
#デフォ状態での引数にアクセストークン系があるかないか 初期になかった場合は処理中にfalseに変更
|
20
|
-
if consumer_keys.size !=4 then
|
21
|
-
puts "error"
|
22
|
-
puts "wrong number of arguments"
|
23
|
-
puts "arguments array is require 4 element"
|
24
|
-
exit
|
25
|
-
end
|
26
|
-
consumer_key = consumer_keys[0]
|
27
|
-
consumer_secret = consumer_keys[1]
|
28
|
-
access_token = consumer_keys[2]
|
29
|
-
access_token_secret = consumer_keys[3]
|
30
|
-
|
31
|
-
@consumer = OAuth::Consumer.new(
|
32
|
-
consumer_key,
|
33
|
-
consumer_secret,
|
34
|
-
:site => "http://api.twitter.com/"
|
35
|
-
)
|
36
|
-
|
37
|
-
if access_token == nil || access_token == "" || access_token_secret == nil || access_token_secret == ""
|
38
|
-
puts "アクセストークンが設定されていないため、アクセストークンを取得します"
|
39
|
-
oauth_array = oauth_init
|
40
|
-
access_token = oauth_array[0]
|
41
|
-
access_token_secret = oauth_array[1]
|
42
|
-
ak_exist = false
|
43
|
-
end
|
44
|
-
|
45
|
-
#puts access_token
|
46
|
-
#puts access_token_secret
|
47
|
-
|
48
|
-
@access_token = OAuth::AccessToken.new(
|
49
|
-
@consumer,
|
50
|
-
access_token,
|
51
|
-
access_token_secret
|
52
|
-
)
|
53
|
-
end#end of function
|
54
|
-
|
55
|
-
def oauth_init
|
56
|
-
begin
|
57
|
-
request_token = @consumer.get_request_token
|
58
|
-
|
59
|
-
# require "Win32API"
|
60
|
-
|
61
|
-
# shellexecute = Win32API.new("shell32.dll","ShellExecuteA",%w(p p p p p i),"i")
|
62
|
-
# shellexecute.call(0, "open", "#{request_token.authorize_url}", 0, 0, 1)
|
63
|
-
|
64
|
-
puts("Access here: #{request_token.authorize_url}\nand...")
|
65
|
-
print("Please input pin:=>")
|
66
|
-
pin = STDIN.gets.chomp
|
67
|
-
puts ""#改行
|
68
|
-
|
69
|
-
access_token = request_token.get_access_token(
|
70
|
-
:oauth_token => request_token.token,
|
71
|
-
:oauth_verifier => pin
|
72
|
-
)
|
73
|
-
|
74
|
-
access_tokens = []
|
75
|
-
access_tokens << access_token.token.to_s
|
76
|
-
access_tokens << access_token.secret.to_s
|
77
|
-
|
78
|
-
return access_tokens
|
79
|
-
end#end of begin
|
80
|
-
end#end of function oauth_init
|
81
|
-
|
82
|
-
##########################################################################
|
83
|
-
#Generate api parameters function
|
84
|
-
def gen_parms(api,parms)
|
85
|
-
hash_str="?"
|
86
|
-
parms.each{|key,value|
|
87
|
-
hash_str+=key.to_s+"="+value.to_s+"&"
|
88
|
-
}
|
89
|
-
hash_str[hash_str.size-1]=""
|
90
|
-
return hash_str.chomp
|
91
|
-
end
|
92
|
-
##########################################################################
|
93
|
-
|
94
|
-
#POST statuses/update
|
95
|
-
def update(str, id="")
|
96
|
-
if (id.empty?) then
|
97
|
-
@access_token.post("/1.1/statuses/update.json",
|
98
|
-
"status" => str)
|
99
|
-
else
|
100
|
-
p @access_token.post("/1.1/statuses/update.json",
|
101
|
-
"status" => str,
|
102
|
-
"in_reply_to_status_id" => id)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
#POST favorites/create
|
107
|
-
def favorite(id)
|
108
|
-
@access_token.post("/1.1/favorites/create.json",
|
109
|
-
"id" => id.to_s)
|
110
|
-
end
|
111
|
-
|
112
|
-
#POST favorites/destroy
|
113
|
-
def unfavorite(id)
|
114
|
-
@access_token.post("/1.1/favorites/destroy.json",
|
115
|
-
"id" => id.to_s)
|
116
|
-
end
|
117
|
-
|
118
|
-
#POST statuses/retweet
|
119
|
-
def retweet(id)
|
120
|
-
@access_token.post("/1.1/statuses/retweet/#{id}.json")
|
121
|
-
end
|
122
|
-
|
123
|
-
#POST statuses/destroy
|
124
|
-
def post_delete(id)
|
125
|
-
@access_token.post("/1.1/statuses/destroy/#{id}.json")
|
126
|
-
end
|
127
|
-
|
128
|
-
#GET account/verify_credentials
|
129
|
-
def verify_credentials
|
130
|
-
return JSON.parse(@access_token.get("/1.1/account/verify_credentials.json").body)
|
131
|
-
end
|
132
|
-
|
133
|
-
#POST friendships/create
|
134
|
-
def follow(screen_name="",user_id="")
|
135
|
-
@access_token.post("/1.1/friendships/create.json",
|
136
|
-
"screen_name" => screen_name,
|
137
|
-
"user_id" => user_id,
|
138
|
-
"follow" => true)
|
139
|
-
end
|
140
|
-
|
141
|
-
#POST friendships/destroy
|
142
|
-
def remove(screen_name="",user_id="")
|
143
|
-
@access_token.post("/1.1/friendships/destroy.json",
|
144
|
-
"screen_name" => screen_name,
|
145
|
-
"user_id" => user_id)
|
146
|
-
end
|
147
|
-
|
148
|
-
#GET statuses/mentions_timeline
|
149
|
-
def mentions_timeline(count="",since_id="",max_id="",trim_user="",contributor_details="",include_entities="")
|
150
|
-
return JSON.parse((@access_token.get("/1.1/statuses/mentions_timeline.json",
|
151
|
-
"count" => count,
|
152
|
-
"since_id" => since_id,
|
153
|
-
"max_id" => max_id,
|
154
|
-
"trim_user" => trim_user,
|
155
|
-
"contributor_details" =>contributor_details,
|
156
|
-
"include_entities" =>include_entities)
|
157
|
-
).body)
|
158
|
-
end
|
159
|
-
|
160
|
-
#GET statuses/home_timeline
|
161
|
-
def home_timeline(count,since_id="",max_id="",trim_user="",include_entities="",include_user_entities="")
|
162
|
-
return JSON.parse(@access_token.get("/1.1/statuses/home_timeline.json",
|
163
|
-
"count" =>count,
|
164
|
-
"since_id" => since_id,
|
165
|
-
"max_id" => max_id,
|
166
|
-
"trim_user" => trim_user,
|
167
|
-
"include_entities" => include_entities,
|
168
|
-
"include_user_entities" => include_user_entities
|
169
|
-
).body)
|
170
|
-
end
|
171
|
-
|
172
|
-
#GET statuses/user_timeline
|
173
|
-
def user_timeline(user_id="",screen_name="",since_id="",count="",max_id="",trim_user="",exclude_replies="",contributor_details="",include_rts="")
|
174
|
-
return JSON.parse(@access_token.get("/1.1/statuses/user_timeline.json",
|
175
|
-
"user_id" => user_id,
|
176
|
-
"screen_name" => screen_name,
|
177
|
-
"since_id" => since_id,
|
178
|
-
"count" => count,
|
179
|
-
"max_id" => max_id,
|
180
|
-
"trim_user" => trim_user,
|
181
|
-
"exclude_replies" => exclude_replies,
|
182
|
-
"contributor_details" => contributor_details,
|
183
|
-
"include_rts" => include_rts
|
184
|
-
).body)
|
185
|
-
end
|
186
|
-
|
187
|
-
#GET statuses/retweets_of_me
|
188
|
-
def get_rom(count,since_id="",max_id="",trim_user="",include_entities="",include_user_entities="")
|
189
|
-
return JSON.parse(@access_token.get("/1.1/statuses/retweets_of_me.json",
|
190
|
-
"count" =>count,
|
191
|
-
"since_id" => since_id,
|
192
|
-
"max_id" => max_id,
|
193
|
-
"trim_user" => trim_user,
|
194
|
-
"include_entities" => include_entities,
|
195
|
-
"include_user_entities" => include_user_entities
|
196
|
-
).body)
|
197
|
-
end
|
198
|
-
|
199
|
-
##########################################################################
|
200
|
-
|
201
|
-
#POST direct_messages/new
|
202
|
-
def dm_send(user_id="",screen_name="",text)
|
203
|
-
if user_id.empty? then
|
204
|
-
return "Error. user_id => empty"
|
205
|
-
end
|
206
|
-
@access_token.get("/1.1/direct_messages/new.json",
|
207
|
-
"user_id" => user_id,
|
208
|
-
"screen_name" => screen_name,
|
209
|
-
"text" => text)
|
210
|
-
end
|
211
|
-
|
212
|
-
#GET direct_messages/sent
|
213
|
-
def get_sent_dm(since_id="",max_id="",count="",page="",include_entities="")
|
214
|
-
if since_id.empty? || max_id.empty? || count.empty? || page.empty? || include_entities.empty? then
|
215
|
-
return "Error. same parms is empty"
|
216
|
-
end
|
217
|
-
|
218
|
-
return JSON.parse(@access_token.get("/1.1/direct_messages/sent.json",
|
219
|
-
"since_id" => since_id,
|
220
|
-
"max_id" => max_id,
|
221
|
-
"count" => count,
|
222
|
-
"page" => page,
|
223
|
-
"include_entities" => include_entities,
|
224
|
-
).body)
|
225
|
-
end
|
226
|
-
|
227
|
-
#GET direct_messages
|
228
|
-
def dm_msgs(since_id="",max_id="",count="",include_entities="",skip_status="")
|
229
|
-
return JSON.parse(@access_token.get("/1.1/direct_messages.json",
|
230
|
-
"since_id" => since_id,
|
231
|
-
"max_id" => max_id,
|
232
|
-
"count" => count,
|
233
|
-
"include_entities" => include_entities,
|
234
|
-
"skip_status" => skip_status
|
235
|
-
).body)
|
236
|
-
end
|
237
|
-
|
238
|
-
#POST direct_messages/destroy
|
239
|
-
def post_dm_destory(id,include_entities="")
|
240
|
-
@access_token.post("/1.1/direct_messages/destroy.json",
|
241
|
-
"id" => id,
|
242
|
-
"include_entities" => include_entities)
|
243
|
-
end
|
244
|
-
|
245
|
-
##########################################################################
|
246
|
-
|
247
|
-
#GET followers/ids
|
248
|
-
def follower_ids(user_id="",screen_name="",cursor="",stringify_ids="",count="")
|
249
|
-
return JSON.parse(@access_token.get("/1.1/followers/ids.json",
|
250
|
-
"user_id" => user_id,
|
251
|
-
"screen_name" => screen_name,
|
252
|
-
"cursor" => cursor,
|
253
|
-
"stringify_ids" => stringify_ids,
|
254
|
-
"count" => count
|
255
|
-
).body)
|
256
|
-
end
|
257
|
-
|
258
|
-
#GET username_available?
|
259
|
-
#存在確認なので真偽値は逆となる trueなら使用可(IDとして新規作成時に)
|
260
|
-
def user_ava?(user_name)
|
261
|
-
|
262
|
-
#for https
|
263
|
-
https = Net::HTTP.new("twitter.com",443)
|
264
|
-
https.use_ssl = true
|
265
|
-
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
266
|
-
|
267
|
-
#get and parse
|
268
|
-
get_torf = JSON.parse(https.get("/users/username_available",
|
269
|
-
"user_name" => user_name).body)["valid"]
|
270
|
-
|
271
|
-
if get_torf == false
|
272
|
-
return true#存在する
|
273
|
-
elsif get_torf == true
|
274
|
-
return false#存在しない
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
#GET account/rate_limit_status
|
279
|
-
def get_rate_limit
|
280
|
-
return JSON.parse((@access_token.get("/1.1/application/rate_limit_status.json")).body)
|
281
|
-
end
|
282
|
-
|
283
|
-
#GET friendships/show
|
284
|
-
def friendships?(source_id="",source_screen_name="",target_id="",target_screen_name="")
|
285
|
-
|
286
|
-
#Convert and Build
|
287
|
-
if source_id.empty? == true && source_screen_name.empty? == false
|
288
|
-
source_ = "source_screen_name"
|
289
|
-
source=source_screen_name
|
290
|
-
elsif source_id.empty? == false && source_screen_name.empty? == true
|
291
|
-
source_ = "source_id"
|
292
|
-
source = source_id
|
293
|
-
else
|
294
|
-
return "ERROR"
|
295
|
-
end
|
296
|
-
|
297
|
-
if target_id.empty? ==true && target_screen_name.empty? == false
|
298
|
-
target_ = "target_screen_name"
|
299
|
-
target = target_screen_name
|
300
|
-
elsif target_id.empty? ==false && target_screen_name.empty? == true
|
301
|
-
target_ = "target_id"
|
302
|
-
target = target_id
|
303
|
-
else
|
304
|
-
return "ERROR"
|
305
|
-
end
|
306
|
-
|
307
|
-
return JSON.parse(@access_token.get("/1.1/friendships/show.json?#{source_}=#{source}&#{target_}=#{target}").body)
|
308
|
-
end
|
309
|
-
|
310
|
-
##########################################################################
|
311
|
-
#Streaming APIs
|
312
|
-
#Usage:Call from block
|
313
|
-
|
314
|
-
#UserStream
|
315
|
-
def user_stream(&block)
|
316
|
-
uri = URI.parse("https://userstream.twitter.com/1.1/user.json")
|
317
|
-
https = Net::HTTP.new(uri.host, uri.port)
|
318
|
-
https.use_ssl = true
|
319
|
-
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
320
|
-
|
321
|
-
https.start do |https|
|
322
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
323
|
-
request.oauth!(https, @consumer, @access_token)
|
324
|
-
buf = ""
|
325
|
-
https.request(request) do |response|
|
326
|
-
response.read_body do |chunk|
|
327
|
-
buf << chunk
|
328
|
-
while(line = buf[/.*(\r\n)+/m])
|
329
|
-
begin
|
330
|
-
buf.sub!(line,"")
|
331
|
-
line.strip!
|
332
|
-
status = JSON.parse(line)
|
333
|
-
rescue
|
334
|
-
break
|
335
|
-
end
|
336
|
-
yield status
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
#Public Sample
|
344
|
-
def public_sample(&block)
|
345
|
-
uri = URI.parse("https://stream.twitter.com/1.1/statuses/sample.json")
|
346
|
-
https = Net::HTTP.new(uri.host, uri.port)
|
347
|
-
https.use_ssl = true
|
348
|
-
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
349
|
-
https.start do |https|
|
350
|
-
request = Net::HTTP::Get.new(uri.request_uri+"track=twitter")
|
351
|
-
request.oauth!(https, @consumer, @access_token)
|
352
|
-
buf = ""
|
353
|
-
https.request(request) do |response|
|
354
|
-
response.read_body do |chunk|
|
355
|
-
buf << chunk
|
356
|
-
while(line = buf[/.*(\r\n)+/m])
|
357
|
-
begin
|
358
|
-
buf.sub!(line,"")
|
359
|
-
line.strip!
|
360
|
-
status = JSON.parse(line)
|
361
|
-
rescue
|
362
|
-
break
|
363
|
-
end
|
364
|
-
yield status
|
365
|
-
end
|
366
|
-
end
|
367
|
-
end
|
368
|
-
end
|
369
|
-
end
|
370
|
-
end#End of Class TwitRuby
|
371
|
-
end#nd of Module TwitRuby
|