pupil 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +6 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +6 -0
- data/README.rdoc +19 -0
- data/VERSION +1 -1
- data/lib/pupil/stream/base.rb +18 -23
- data/pupil.gemspec +8 -34
- data/samples/ff-dumper.rb +19 -0
- metadata +21 -47
- data/doc/Pupil.html +0 -3451
- data/doc/Pupil/DirectMessage.html +0 -848
- data/doc/Pupil/Entities.html +0 -416
- data/doc/Pupil/Hashtag.html +0 -416
- data/doc/Pupil/Keygen.html +0 -838
- data/doc/Pupil/Keygen/MissingRequiredTokens.html +0 -116
- data/doc/Pupil/List.html +0 -992
- data/doc/Pupil/NetworkError.html +0 -116
- data/doc/Pupil/Status.html +0 -1574
- data/doc/Pupil/Stream.html +0 -618
- data/doc/Pupil/Stream/Shash.html +0 -390
- data/doc/Pupil/Stream/Status.html +0 -377
- data/doc/Pupil/Stream/StreamError.html +0 -116
- data/doc/Pupil/URL.html +0 -488
- data/doc/Pupil/UnsupportedParameter.html +0 -116
- data/doc/Pupil/User.html +0 -3008
- data/doc/_index.html +0 -289
- data/doc/class_list.html +0 -47
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -55
- data/doc/css/style.css +0 -322
- data/doc/file.LICENSE.html +0 -66
- data/doc/file.README.html +0 -184
- data/doc/file_list.html +0 -52
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -184
- data/doc/js/app.js +0 -205
- data/doc/js/full_list.js +0 -167
- data/doc/js/jquery.js +0 -16
- data/doc/method_list.html +0 -1222
- data/doc/top-level-namespace.html +0 -103
data/doc/file.LICENSE.html
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
-
<title>
|
7
|
-
File: LICENSE
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="_index.html" title="Index">Index</a> »
|
37
|
-
<span class="title">File: LICENSE</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a id="class_list_link" href="#">Class List</a>
|
46
|
-
|
47
|
-
<a id="method_list_link" href="#">Method List</a>
|
48
|
-
|
49
|
-
<a id="file_list_link" href="#">File List</a>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
<div class="clear"></div>
|
53
|
-
</div>
|
54
|
-
|
55
|
-
<iframe id="search_frame"></iframe>
|
56
|
-
|
57
|
-
<div id="content"><div id='filecontents'>Copyright (c) 2011 Oame<br/><br/>Permission is hereby granted, free of charge, to any person obtaining<br/>a copy of this software and associated documentation files (the<br/>"Software"), to deal in the Software without restriction, including<br/>without limitation the rights to use, copy, modify, merge, publish,<br/>distribute, sublicense, and/or sell copies of the Software, and to<br/>permit persons to whom the Software is furnished to do so, subject to<br/>the following conditions:<br/><br/>The above copyright notice and this permission notice shall be<br/>included in all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,<br/>EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br/>MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND<br/>NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE<br/>LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION<br/>OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION<br/>WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</div></div>
|
58
|
-
|
59
|
-
<div id="footer">
|
60
|
-
Generated on Sat Dec 17 20:58:32 2011 by
|
61
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
62
|
-
0.7.4 (ruby-1.9.2).
|
63
|
-
</div>
|
64
|
-
|
65
|
-
</body>
|
66
|
-
</html>
|
data/doc/file.README.html
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
-
<title>
|
7
|
-
File: README
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="_index.html" title="Index">Index</a> »
|
37
|
-
<span class="title">File: README</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a id="class_list_link" href="#">Class List</a>
|
46
|
-
|
47
|
-
<a id="method_list_link" href="#">Method List</a>
|
48
|
-
|
49
|
-
<a id="file_list_link" href="#">File List</a>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
<div class="clear"></div>
|
53
|
-
</div>
|
54
|
-
|
55
|
-
<iframe id="search_frame"></iframe>
|
56
|
-
|
57
|
-
<div id="content"><div id='filecontents'><h1>pupil</h1>
|
58
|
-
|
59
|
-
<p>Pupil is "Lazy" Twitter API Library for Ruby 1.9.x.
|
60
|
-
Easy to use.</p>
|
61
|
-
|
62
|
-
<h2>Features / Problems</h2>
|
63
|
-
|
64
|
-
<ul>
|
65
|
-
<li>Almost Twitter REST API are wrapped. However, some API does not support yet.</li>
|
66
|
-
<li>Twitter Streaming API are supported experimentally.</li>
|
67
|
-
<li>Intuitive syntax.</li>
|
68
|
-
</ul>
|
69
|
-
|
70
|
-
|
71
|
-
<h2>Requirement</h2>
|
72
|
-
|
73
|
-
<ul>
|
74
|
-
<li>json and oauth gem</li>
|
75
|
-
<li>Ruby 1.9.x</li>
|
76
|
-
</ul>
|
77
|
-
|
78
|
-
|
79
|
-
<h2>Installation</h2>
|
80
|
-
|
81
|
-
<pre class="code"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_pupil'>pupil</span>
|
82
|
-
</pre>
|
83
|
-
|
84
|
-
<h2>Examples</h2>
|
85
|
-
|
86
|
-
<pre class="code"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pupil</span><span class='tstring_end'>"</span></span>
|
87
|
-
|
88
|
-
<span class='const'>CONSUMER</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
89
|
-
<span class='symbol'>:app_name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Web Service</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Optional
|
90
|
-
</span> <span class='symbol'>:app_author</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>o_ame</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Optional
|
91
|
-
</span> <span class='symbol'>:consumer_key</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Required
|
92
|
-
</span> <span class='symbol'>:consumer_secret</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span> <span class='comment'># Required
|
93
|
-
</span><span class='rbrace'>}</span>
|
94
|
-
|
95
|
-
<span class='id identifier rubyid_pupil_key'>pupil_key</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
96
|
-
<span class='symbol'>:screen_name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>o_ame</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Required
|
97
|
-
</span> <span class='symbol'>:access_token</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Required
|
98
|
-
</span> <span class='symbol'>:access_token_secret</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span> <span class='comment'># Required
|
99
|
-
</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span> <span class='const'>CONSUMER</span>
|
100
|
-
|
101
|
-
<span class='id identifier rubyid_pupil'>pupil</span> <span class='op'>=</span> <span class='const'>Pupil</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_pupil_key'>pupil_key</span>
|
102
|
-
|
103
|
-
<span class='comment'># Get timeline statuses without replies
|
104
|
-
</span><span class='id identifier rubyid_pupil'>pupil</span><span class='period'>.</span><span class='id identifier rubyid_home_timeline'>home_timeline</span> <span class='symbol'>:count</span> <span class='op'>=></span> <span class='int'>50</span><span class='comma'>,</span> <span class='symbol'>:exclude</span> <span class='op'>=></span> <span class='symbol'>:replies</span>
|
105
|
-
|
106
|
-
<span class='comment'># Follow User
|
107
|
-
</span><span class='id identifier rubyid_pupil'>pupil</span><span class='period'>.</span><span class='id identifier rubyid_follow'>follow</span> <span class='symbol'>:screen_name</span> <span class='op'>=></span> <span class='symbol'>:twitterapi</span>
|
108
|
-
|
109
|
-
<span class='comment'># Update URL on profile
|
110
|
-
</span><span class='id identifier rubyid_pupil'>pupil</span><span class='period'>.</span><span class='id identifier rubyid_update_profile'>update_profile</span> <span class='symbol'>:url</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://oameya.com</span><span class='tstring_end'>"</span></span>
|
111
|
-
</pre>
|
112
|
-
|
113
|
-
<p>Using Streaming API</p>
|
114
|
-
|
115
|
-
<pre class="code">require "pupil/stream"
|
116
|
-
|
117
|
-
CONSUMER = {
|
118
|
-
:app_name => "Web Service",
|
119
|
-
:app_author => "o_ame",
|
120
|
-
:consumer_key => "something",
|
121
|
-
:consumer_secret => "something"
|
122
|
-
}
|
123
|
-
|
124
|
-
pupil_key = {
|
125
|
-
:screen_name => "o_ame",
|
126
|
-
:access_token => "something",
|
127
|
-
:access_token_secret => "something"
|
128
|
-
}.update CONSUMER
|
129
|
-
|
130
|
-
stream = Pupil::Stream.new pupil_key
|
131
|
-
|
132
|
-
# Userstream
|
133
|
-
stream.start :userstream do |status|
|
134
|
-
puts status.type #=> Show type of status
|
135
|
-
if status.type == :retweeted
|
136
|
-
puts "#{status.content['user']['screen_name']: #{status.content['text']}"
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
# Search stream
|
141
|
-
stream.start :filter, :track => "#MerryChristmas" do |status|
|
142
|
-
puts "#{status['user']['screen_name']: #{status['text']}"
|
143
|
-
end
|
144
|
-
</pre>
|
145
|
-
|
146
|
-
<p>Making <code>pupil_key</code></p>
|
147
|
-
|
148
|
-
<pre class="code"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pupil/keygen</span><span class='tstring_end'>"</span></span>
|
149
|
-
|
150
|
-
<span class='id identifier rubyid_keygen'>keygen</span> <span class='op'>=</span> <span class='const'>Pupil</span><span class='op'>::</span><span class='const'>Keygen</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
151
|
-
<span class='id identifier rubyid_keygen'>keygen</span><span class='period'>.</span><span class='id identifier rubyid_interactive'>interactive</span> <span class='comment'>#=> Generate pupil_key interactively
|
152
|
-
</span></pre>
|
153
|
-
|
154
|
-
<h2>Contributing to pupil</h2>
|
155
|
-
|
156
|
-
<ul>
|
157
|
-
<li>Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet</li>
|
158
|
-
<li>Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it</li>
|
159
|
-
<li>Fork the project</li>
|
160
|
-
<li>Start a feature/bugfix branch</li>
|
161
|
-
<li>Commit and push until you are happy with your contribution</li>
|
162
|
-
<li>Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.</li>
|
163
|
-
<li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
|
164
|
-
</ul>
|
165
|
-
|
166
|
-
|
167
|
-
<h2>Credits</h2>
|
168
|
-
|
169
|
-
<p>Developer: <a href="http://twitter.com/o_ame">Oame</a></p>
|
170
|
-
|
171
|
-
<h2>License</h2>
|
172
|
-
|
173
|
-
<p>Copyright (c) 2011 Oame. See LICENSE.txt for
|
174
|
-
further details.</p>
|
175
|
-
</div></div>
|
176
|
-
|
177
|
-
<div id="footer">
|
178
|
-
Generated on Sat Dec 17 20:58:32 2011 by
|
179
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
180
|
-
0.7.4 (ruby-1.9.2).
|
181
|
-
</div>
|
182
|
-
|
183
|
-
</body>
|
184
|
-
</html>
|
data/doc/file_list.html
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
|
7
|
-
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
-
|
9
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
-
|
17
|
-
|
18
|
-
<base id="base_target" target="_parent" />
|
19
|
-
</head>
|
20
|
-
<body>
|
21
|
-
<script type="text/javascript" charset="utf-8">
|
22
|
-
if (window.top.frames.main) {
|
23
|
-
document.getElementById('base_target').target = 'main';
|
24
|
-
document.body.className = 'frames';
|
25
|
-
}
|
26
|
-
</script>
|
27
|
-
<div id="content">
|
28
|
-
<h1 id="full_list_header">File List</h1>
|
29
|
-
<div id="nav">
|
30
|
-
|
31
|
-
<a target="_self" href="class_list.html">Classes</a>
|
32
|
-
|
33
|
-
<a target="_self" href="method_list.html">Methods</a>
|
34
|
-
|
35
|
-
<a target="_self" href="file_list.html">Files</a>
|
36
|
-
|
37
|
-
</div>
|
38
|
-
<div id="search">Search: <input type="text" /></div>
|
39
|
-
|
40
|
-
<ul id="full_list" class="files">
|
41
|
-
|
42
|
-
|
43
|
-
<li class="r1"><a href="index.html" title="README">README</a></li>
|
44
|
-
|
45
|
-
|
46
|
-
<li class="r2"><a href="file.LICENSE.html" title="LICENSE">LICENSE</a></li>
|
47
|
-
|
48
|
-
|
49
|
-
</ul>
|
50
|
-
</div>
|
51
|
-
</body>
|
52
|
-
</html>
|
data/doc/frames.html
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
-
<title>Documentation by YARD 0.7.4</title>
|
8
|
-
</head>
|
9
|
-
<frameset cols="20%,*">
|
10
|
-
<frame name="list" src="class_list.html" />
|
11
|
-
<frame name="main" src="index.html" />
|
12
|
-
</frameset>
|
13
|
-
</html>
|
data/doc/index.html
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
-
<title>
|
7
|
-
File: README
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="_index.html" title="Index">Index</a> »
|
37
|
-
<span class="title">File: README</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a id="class_list_link" href="#">Class List</a>
|
46
|
-
|
47
|
-
<a id="method_list_link" href="#">Method List</a>
|
48
|
-
|
49
|
-
<a id="file_list_link" href="#">File List</a>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
<div class="clear"></div>
|
53
|
-
</div>
|
54
|
-
|
55
|
-
<iframe id="search_frame"></iframe>
|
56
|
-
|
57
|
-
<div id="content"><div id='filecontents'><h1>pupil</h1>
|
58
|
-
|
59
|
-
<p>Pupil is "Lazy" Twitter API Library for Ruby 1.9.x.
|
60
|
-
Easy to use.</p>
|
61
|
-
|
62
|
-
<h2>Features / Problems</h2>
|
63
|
-
|
64
|
-
<ul>
|
65
|
-
<li>Almost Twitter REST API are wrapped. However, some API does not support yet.</li>
|
66
|
-
<li>Twitter Streaming API are supported experimentally.</li>
|
67
|
-
<li>Intuitive syntax.</li>
|
68
|
-
</ul>
|
69
|
-
|
70
|
-
|
71
|
-
<h2>Requirement</h2>
|
72
|
-
|
73
|
-
<ul>
|
74
|
-
<li>json and oauth gem</li>
|
75
|
-
<li>Ruby 1.9.x</li>
|
76
|
-
</ul>
|
77
|
-
|
78
|
-
|
79
|
-
<h2>Installation</h2>
|
80
|
-
|
81
|
-
<pre class="code"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_pupil'>pupil</span>
|
82
|
-
</pre>
|
83
|
-
|
84
|
-
<h2>Examples</h2>
|
85
|
-
|
86
|
-
<pre class="code"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pupil</span><span class='tstring_end'>"</span></span>
|
87
|
-
|
88
|
-
<span class='const'>CONSUMER</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
89
|
-
<span class='symbol'>:app_name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Web Service</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Optional
|
90
|
-
</span> <span class='symbol'>:app_author</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>o_ame</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Optional
|
91
|
-
</span> <span class='symbol'>:consumer_key</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Required
|
92
|
-
</span> <span class='symbol'>:consumer_secret</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span> <span class='comment'># Required
|
93
|
-
</span><span class='rbrace'>}</span>
|
94
|
-
|
95
|
-
<span class='id identifier rubyid_pupil_key'>pupil_key</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
96
|
-
<span class='symbol'>:screen_name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>o_ame</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Required
|
97
|
-
</span> <span class='symbol'>:access_token</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='comment'># Required
|
98
|
-
</span> <span class='symbol'>:access_token_secret</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something</span><span class='tstring_end'>"</span></span> <span class='comment'># Required
|
99
|
-
</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span> <span class='const'>CONSUMER</span>
|
100
|
-
|
101
|
-
<span class='id identifier rubyid_pupil'>pupil</span> <span class='op'>=</span> <span class='const'>Pupil</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_pupil_key'>pupil_key</span>
|
102
|
-
|
103
|
-
<span class='comment'># Get timeline statuses without replies
|
104
|
-
</span><span class='id identifier rubyid_pupil'>pupil</span><span class='period'>.</span><span class='id identifier rubyid_home_timeline'>home_timeline</span> <span class='symbol'>:count</span> <span class='op'>=></span> <span class='int'>50</span><span class='comma'>,</span> <span class='symbol'>:exclude</span> <span class='op'>=></span> <span class='symbol'>:replies</span>
|
105
|
-
|
106
|
-
<span class='comment'># Follow User
|
107
|
-
</span><span class='id identifier rubyid_pupil'>pupil</span><span class='period'>.</span><span class='id identifier rubyid_follow'>follow</span> <span class='symbol'>:screen_name</span> <span class='op'>=></span> <span class='symbol'>:twitterapi</span>
|
108
|
-
|
109
|
-
<span class='comment'># Update URL on profile
|
110
|
-
</span><span class='id identifier rubyid_pupil'>pupil</span><span class='period'>.</span><span class='id identifier rubyid_update_profile'>update_profile</span> <span class='symbol'>:url</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>http://oameya.com</span><span class='tstring_end'>"</span></span>
|
111
|
-
</pre>
|
112
|
-
|
113
|
-
<p>Using Streaming API</p>
|
114
|
-
|
115
|
-
<pre class="code">require "pupil/stream"
|
116
|
-
|
117
|
-
CONSUMER = {
|
118
|
-
:app_name => "Web Service",
|
119
|
-
:app_author => "o_ame",
|
120
|
-
:consumer_key => "something",
|
121
|
-
:consumer_secret => "something"
|
122
|
-
}
|
123
|
-
|
124
|
-
pupil_key = {
|
125
|
-
:screen_name => "o_ame",
|
126
|
-
:access_token => "something",
|
127
|
-
:access_token_secret => "something"
|
128
|
-
}.update CONSUMER
|
129
|
-
|
130
|
-
stream = Pupil::Stream.new pupil_key
|
131
|
-
|
132
|
-
# Userstream
|
133
|
-
stream.start :userstream do |status|
|
134
|
-
puts status.type #=> Show type of status
|
135
|
-
if status.type == :retweeted
|
136
|
-
puts "#{status.content['user']['screen_name']: #{status.content['text']}"
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
# Search stream
|
141
|
-
stream.start :filter, :track => "#MerryChristmas" do |status|
|
142
|
-
puts "#{status['user']['screen_name']: #{status['text']}"
|
143
|
-
end
|
144
|
-
</pre>
|
145
|
-
|
146
|
-
<p>Making <code>pupil_key</code></p>
|
147
|
-
|
148
|
-
<pre class="code"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pupil/keygen</span><span class='tstring_end'>"</span></span>
|
149
|
-
|
150
|
-
<span class='id identifier rubyid_keygen'>keygen</span> <span class='op'>=</span> <span class='const'>Pupil</span><span class='op'>::</span><span class='const'>Keygen</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
151
|
-
<span class='id identifier rubyid_keygen'>keygen</span><span class='period'>.</span><span class='id identifier rubyid_interactive'>interactive</span> <span class='comment'>#=> Generate pupil_key interactively
|
152
|
-
</span></pre>
|
153
|
-
|
154
|
-
<h2>Contributing to pupil</h2>
|
155
|
-
|
156
|
-
<ul>
|
157
|
-
<li>Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet</li>
|
158
|
-
<li>Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it</li>
|
159
|
-
<li>Fork the project</li>
|
160
|
-
<li>Start a feature/bugfix branch</li>
|
161
|
-
<li>Commit and push until you are happy with your contribution</li>
|
162
|
-
<li>Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.</li>
|
163
|
-
<li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
|
164
|
-
</ul>
|
165
|
-
|
166
|
-
|
167
|
-
<h2>Credits</h2>
|
168
|
-
|
169
|
-
<p>Developer: <a href="http://twitter.com/o_ame">Oame</a></p>
|
170
|
-
|
171
|
-
<h2>License</h2>
|
172
|
-
|
173
|
-
<p>Copyright (c) 2011 Oame. See LICENSE.txt for
|
174
|
-
further details.</p>
|
175
|
-
</div></div>
|
176
|
-
|
177
|
-
<div id="footer">
|
178
|
-
Generated on Sat Dec 17 20:58:32 2011 by
|
179
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
180
|
-
0.7.4 (ruby-1.9.2).
|
181
|
-
</div>
|
182
|
-
|
183
|
-
</body>
|
184
|
-
</html>
|