safubot 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.yardoc/checksums +9 -0
  2. data/.yardoc/objects/root.dat +0 -0
  3. data/.yardoc/proxy_types +0 -0
  4. data/README.md +52 -1
  5. data/doc/Safubot/Bot.html +1287 -652
  6. data/doc/Safubot/Evented.html +409 -276
  7. data/doc/Safubot/KnownUser.html +476 -254
  8. data/doc/Safubot/Log.html +184 -192
  9. data/doc/Safubot/Query.html +131 -164
  10. data/doc/Safubot/Request.html +158 -147
  11. data/doc/Safubot/Response.html +92 -135
  12. data/doc/Safubot/Test.html +166 -187
  13. data/doc/Safubot/Twitter/Bot.html +1005 -455
  14. data/doc/Safubot/Twitter/DirectMessage.html +417 -238
  15. data/doc/Safubot/Twitter/Tweet.html +725 -398
  16. data/doc/Safubot/Twitter.html +69 -116
  17. data/doc/Safubot/XMPP/Bot.html +625 -303
  18. data/doc/Safubot/XMPP/Message.html +372 -217
  19. data/doc/Safubot/XMPP.html +69 -116
  20. data/doc/Safubot.html +155 -126
  21. data/doc/_index.html +294 -0
  22. data/doc/class_list.html +47 -0
  23. data/doc/css/common.css +1 -0
  24. data/doc/css/full_list.css +55 -0
  25. data/doc/css/style.css +322 -0
  26. data/doc/file.README.html +140 -0
  27. data/doc/file_list.html +49 -0
  28. data/doc/frames.html +13 -0
  29. data/doc/index.html +129 -101
  30. data/doc/js/app.js +205 -0
  31. data/doc/js/full_list.js +167 -0
  32. data/doc/js/jquery.js +3 -5
  33. data/doc/method_list.html +638 -0
  34. data/doc/top-level-namespace.html +103 -0
  35. data/lib/safubot/bot.rb +22 -20
  36. data/lib/safubot/known_user.rb +2 -0
  37. data/lib/safubot/twitter.rb +30 -26
  38. data/lib/safubot/version.rb +1 -1
  39. data/lib/safubot/xmpp.rb +20 -14
  40. data/safubot.gemspec +1 -0
  41. metadata +50 -71
  42. data/doc/Gemfile.html +0 -119
  43. data/doc/Object.html +0 -171
  44. data/doc/Rakefile.html +0 -117
  45. data/doc/created.rid +0 -14
  46. data/doc/foo_rb.html +0 -115
  47. data/doc/images/add.png +0 -0
  48. data/doc/images/brick.png +0 -0
  49. data/doc/images/brick_link.png +0 -0
  50. data/doc/images/bug.png +0 -0
  51. data/doc/images/bullet_black.png +0 -0
  52. data/doc/images/bullet_toggle_minus.png +0 -0
  53. data/doc/images/bullet_toggle_plus.png +0 -0
  54. data/doc/images/date.png +0 -0
  55. data/doc/images/delete.png +0 -0
  56. data/doc/images/find.png +0 -0
  57. data/doc/images/loadingAnimation.gif +0 -0
  58. data/doc/images/macFFBgHack.png +0 -0
  59. data/doc/images/package.png +0 -0
  60. data/doc/images/page_green.png +0 -0
  61. data/doc/images/page_white_text.png +0 -0
  62. data/doc/images/page_white_width.png +0 -0
  63. data/doc/images/plugin.png +0 -0
  64. data/doc/images/ruby.png +0 -0
  65. data/doc/images/tag_blue.png +0 -0
  66. data/doc/images/tag_green.png +0 -0
  67. data/doc/images/transparent.png +0 -0
  68. data/doc/images/wrench.png +0 -0
  69. data/doc/images/wrench_orange.png +0 -0
  70. data/doc/images/zoom.png +0 -0
  71. data/doc/js/darkfish.js +0 -153
  72. data/doc/js/navigation.js +0 -142
  73. data/doc/js/search.js +0 -94
  74. data/doc/js/search_index.js +0 -1
  75. data/doc/js/searcher.js +0 -228
  76. data/doc/lib/safubot/bot_rb.html +0 -115
  77. data/doc/lib/safubot/evented_rb.html +0 -115
  78. data/doc/lib/safubot/known_user_rb.html +0 -115
  79. data/doc/lib/safubot/log_rb.html +0 -115
  80. data/doc/lib/safubot/safubot_rb.html +0 -115
  81. data/doc/lib/safubot/spec/bot_spec_rb.html +0 -115
  82. data/doc/lib/safubot/spec/twitter_spec_rb.html +0 -137
  83. data/doc/lib/safubot/test_helper_rb.html +0 -115
  84. data/doc/lib/safubot/twitter_rb.html +0 -115
  85. data/doc/lib/safubot/version_rb.html +0 -115
  86. data/doc/lib/safubot/xmpp_rb.html +0 -115
  87. data/doc/lib/safubot_rb.html +0 -115
  88. data/doc/rdoc.css +0 -543
  89. data/doc/table_of_contents.html +0 -224
@@ -1,591 +1,1141 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
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
+ Class: Safubot::Twitter::Bot
8
+
9
+ &mdash; Documentation by YARD 0.7.3
10
+
11
+ </title>
6
12
 
7
- <title>Class: Safubot::Twitter::Bot</title>
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
14
 
9
- <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
10
16
 
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "../../";
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '../..';
19
+ if (relpath != '') relpath += '/';
13
20
  </script>
14
21
 
15
- <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="../../index.html">Home</a>
28
- <a href="../../table_of_contents.html#classes">Classes</a>
29
- <a href="../../table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
- <div id="file-metadata">
47
- <nav id="file-list-section" class="section">
48
- <h3 class="section-header">Defined In</h3>
49
- <ul>
50
- <li>lib/safubot/twitter.rb
51
- </ul>
52
- </nav>
22
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
53
23
 
54
-
55
- </div>
24
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
56
25
 
57
- <div id="class-metadata">
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>
58
32
 
59
- <nav id="parent-class-section" class="section">
60
- <h3 class="section-header">Parent</h3>
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../../_index.html">Index (B)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../../Safubot.html" title="Safubot (module)">Safubot</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Twitter.html" title="Safubot::Twitter (module)">Twitter</a></span></span>
38
+ &raquo;
39
+ <span class="title">Bot</span>
61
40
 
62
- <p class="link"><a href="../../Object.html">Object</a>
63
41
 
64
- </nav>
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
65
44
 
66
- <!-- Included Modules -->
67
- <nav id="includes-section" class="section">
68
- <h3 class="section-header">Included Modules</h3>
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: Safubot::Twitter::Bot
60
+
61
+
62
+
63
+ </h1>
69
64
 
70
- <ul class="link-list">
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName">Object</span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">Safubot::Twitter::Bot</li>
75
+
76
+ </ul>
77
+ <a href="#" class="inheritanceTree">show all</a>
78
+
79
+ </dd>
80
+
71
81
 
72
82
 
73
- <li><a class="include" href="../Evented.html">Safubot::Evented</a>
83
+
74
84
 
85
+
86
+ <dt class="r2">Includes:</dt>
87
+ <dd class="r2"><span class='object_link'><a href="../Evented.html" title="Safubot::Evented (module)">Evented</a></span></dd>
88
+
89
+
75
90
 
76
- </ul>
77
- </nav>
91
+
92
+
93
+ <dt class="r1 last">Defined in:</dt>
94
+ <dd class="r1 last">lib/safubot/twitter.rb</dd>
95
+
96
+ </dl>
97
+ <div class="clear"></div>
98
+
99
+ <h2>Overview</h2><div class="docstring">
100
+ <div class="discussion">
101
+ <p>
102
+ A Twitter::Bot instance provides a Safubot::Bot with Twitter-specific
103
+ processing.
104
+ </p>
78
105
 
79
- <!-- Method Quickref -->
80
- <nav id="method-list-section" class="section">
81
- <h3 class="section-header">Methods</h3>
82
106
 
83
- <ul class="link-list">
107
+ </div>
108
+ </div>
109
+ <div class="tags">
110
+
111
+
112
+ </div>
113
+
114
+
115
+
116
+
117
+
118
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
119
+ <ul class="summary">
84
120
 
85
- <li><a href="#method-c-new">::new</a>
121
+ <li class="public ">
122
+ <span class="summary_signature">
86
123
 
87
- <li><a href="#method-i-handle_message">#handle_message</a>
124
+ <a href="#client-instance_method" title="#client (instance method)">- (Object) <strong>client</strong> </a>
88
125
 
89
- <li><a href="#method-i-handle_request">#handle_request</a>
126
+
90
127
 
91
- <li><a href="#method-i-handle_tweet">#handle_tweet</a>
128
+ </span>
129
+
130
+
131
+ <span class="note title readonly">readonly</span>
92
132
 
93
- <li><a href="#method-i-pull">#pull</a>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <span class="summary_desc"><div class='inline'><p>
141
+ Returns the value of attribute client.
142
+ </p>
143
+ </div></span>
144
+
145
+ </li>
146
+
94
147
 
95
- <li><a href="#method-i-reply">#reply</a>
148
+ <li class="public ">
149
+ <span class="summary_signature">
96
150
 
97
- <li><a href="#method-i-reply_header">#reply_header</a>
151
+ <a href="#opts-instance_method" title="#opts (instance method)">- (Object) <strong>opts</strong> </a>
98
152
 
99
- <li><a href="#method-i-run">#run</a>
153
+
100
154
 
101
- <li><a href="#method-i-send">#send</a>
155
+ </span>
156
+
157
+
158
+ <span class="note title readonly">readonly</span>
102
159
 
103
- </ul>
104
- </nav>
160
+
161
+
162
+
163
+
164
+
105
165
 
106
- </div>
166
+
167
+ <span class="summary_desc"><div class='inline'><p>
168
+ Returns the value of attribute opts.
169
+ </p>
170
+ </div></span>
171
+
172
+ </li>
107
173
 
108
- <div id="project-metadata">
109
- <nav id="fileindex-section" class="section project-section">
110
- <h3 class="section-header">Pages</h3>
174
+
175
+ <li class="public ">
176
+ <span class="summary_signature">
177
+
178
+ <a href="#username-instance_method" title="#username (instance method)">- (Object) <strong>username</strong> </a>
179
+
111
180
 
112
- <ul>
181
+
182
+ </span>
183
+
184
+
185
+ <span class="note title readonly">readonly</span>
186
+
187
+
188
+
113
189
 
114
- <li class="file"><a href="../../Gemfile.html">Gemfile</a>
115
190
 
116
- <li class="file"><a href="../../Rakefile.html">Rakefile</a>
117
191
 
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'><p>
195
+ Returns the value of attribute username.
196
+ </p>
197
+ </div></span>
198
+
199
+ </li>
200
+
201
+
118
202
  </ul>
119
- </nav>
120
203
 
121
- <nav id="classindex-section" class="section project-section">
122
- <h3 class="section-header">Class and Module Index</h3>
123
204
 
124
- <ul class="link-list">
205
+
125
206
 
126
- <li><a href="../../Safubot.html">Safubot</a>
127
207
 
128
- <li><a href="../../Safubot/Bot.html">Safubot::Bot</a>
129
208
 
130
- <li><a href="../../Safubot/Evented.html">Safubot::Evented</a>
209
+
131
210
 
132
- <li><a href="../../Safubot/KnownUser.html">Safubot::KnownUser</a>
211
+ <h2>
212
+ Instance Method Summary
213
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
214
+ </h2>
215
+
216
+ <ul class="summary">
217
+
218
+ <li class="public ">
219
+ <span class="summary_signature">
220
+
221
+ <a href="#handle_message-instance_method" title="#handle_message (instance method)">- (Object) <strong>handle_message</strong>(message) </a>
222
+
223
+
224
+
225
+ </span>
133
226
 
134
- <li><a href="../../Safubot/Log.html">Safubot::Log</a>
135
227
 
136
- <li><a href="../../Safubot/Query.html">Safubot::Query</a>
137
228
 
138
- <li><a href="../../Safubot/Request.html">Safubot::Request</a>
139
229
 
140
- <li><a href="../../Safubot/Response.html">Safubot::Response</a>
141
230
 
142
- <li><a href="../../Safubot/Test.html">Safubot::Test</a>
143
231
 
144
- <li><a href="../../Safubot/Twitter.html">Safubot::Twitter</a>
232
+
145
233
 
146
- <li><a href="../../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
234
+ <span class="summary_desc"><div class='inline'><p>
235
+ Stores a DM and creates a matching Request as needed.
236
+ </p>
237
+ </div></span>
147
238
 
148
- <li><a href="../../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
239
+ </li>
240
+
241
+
242
+ <li class="public ">
243
+ <span class="summary_signature">
244
+
245
+ <a href="#handle_request-instance_method" title="#handle_request (instance method)">- (Object) <strong>handle_request</strong>(req) </a>
246
+
247
+
248
+
249
+ </span>
149
250
 
150
- <li><a href="../../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
151
251
 
152
- <li><a href="../../Safubot/XMPP.html">Safubot::XMPP</a>
153
252
 
154
- <li><a href="../../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
155
253
 
156
- <li><a href="../../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
157
254
 
158
- <li><a href="../../Object.html">Object</a>
159
255
 
160
- </ul>
161
- </nav>
162
256
 
163
- </div>
164
- </nav>
165
-
166
- <div id="documentation">
167
- <h1 class="class">class Safubot::Twitter::Bot</h1>
257
+
258
+ <span class="summary_desc"><div class='inline'><p>
259
+ Emit a request event unless the request is already processed.
260
+ </p>
261
+ </div></span>
262
+
263
+ </li>
168
264
 
169
- <div id="description" class="description">
265
+
266
+ <li class="public ">
267
+ <span class="summary_signature">
268
+
269
+ <a href="#handle_tweet-instance_method" title="#handle_tweet (instance method)">- (Object) <strong>handle_tweet</strong>(status) </a>
170
270
 
171
- <p>A <a href="Bot.html">Twitter::Bot</a> instance provides a <a
172
- href="../Bot.html">Safubot::Bot</a> with Twitter-specific processing.</p>
173
-
174
- </div><!-- description -->
175
271
 
272
+
273
+ </span>
274
+
275
+
176
276
 
177
277
 
178
278
 
179
- <section id="5Buntitled-5D" class="documentation-section">
279
+
280
+
281
+
282
+ <span class="summary_desc"><div class='inline'><p>
283
+ Stores a tweet.
284
+ </p>
285
+ </div></span>
286
+
287
+ </li>
288
+
289
+
290
+ <li class="public ">
291
+ <span class="summary_signature">
292
+
293
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Bot) <strong>initialize</strong>(options = {}) </a>
180
294
 
181
295
 
182
296
 
297
+ </span>
298
+
299
+ <span class="note title constructor">constructor</span>
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+ <span class="summary_desc"><div class='inline'><p>
309
+ Options are passed straight through to ::TweetStream and ::Twitter, but the
310
+ :username is ours and important.
311
+ </p>
312
+ </div></span>
313
+
314
+ </li>
183
315
 
316
+
317
+ <li class="public ">
318
+ <span class="summary_signature">
319
+
320
+ <a href="#pull-instance_method" title="#pull (instance method)">- (Object) <strong>pull</strong> </a>
184
321
 
185
322
 
186
323
 
187
- <!-- Attributes -->
188
- <section id="attribute-method-details" class="method-section section">
189
- <h3 class="section-header">Attributes</h3>
324
+ </span>
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+ <span class="summary_desc"><div class='inline'><p>
334
+ Pulls DMs and mentions using the AJAX API.
335
+ </p>
336
+ </div></span>
337
+
338
+ </li>
190
339
 
191
340
 
192
- <div id="attribute-i-client" class="method-detail">
193
- <div class="method-heading attribute-method-heading">
194
- <span class="method-name">client</span><span
195
- class="attribute-access-type">[R]</span>
196
- </div>
197
-
198
- <div class="method-description">
199
-
200
-
201
-
202
- </div>
203
- </div>
204
-
205
- <div id="attribute-i-opts" class="method-detail">
206
- <div class="method-heading attribute-method-heading">
207
- <span class="method-name">opts</span><span
208
- class="attribute-access-type">[R]</span>
209
- </div>
210
-
211
- <div class="method-description">
212
-
213
-
214
-
215
- </div>
216
- </div>
217
-
218
- <div id="attribute-i-username" class="method-detail">
219
- <div class="method-heading attribute-method-heading">
220
- <span class="method-name">username</span><span
221
- class="attribute-access-type">[R]</span>
222
- </div>
223
-
224
- <div class="method-description">
225
-
226
-
227
-
228
- </div>
229
- </div>
230
-
231
- </section><!-- attribute-method-details -->
341
+ <li class="public ">
342
+ <span class="summary_signature">
232
343
 
233
-
234
- <!-- Methods -->
344
+ <a href="#reply-instance_method" title="#reply (instance method)">- (Object) <strong>reply</strong>(tweet, text) </a>
235
345
 
236
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
237
- <h3 class="section-header">Public Class Methods</h3>
238
346
 
239
347
 
240
- <div id="method-c-new" class="method-detail ">
241
-
242
- <div class="method-heading">
243
- <span class="method-name">new</span><span
244
- class="method-args">(options={})</span>
245
- <span class="method-click-advice">click to toggle source</span>
246
- </div>
247
-
348
+ </span>
349
+
350
+
351
+
352
+
353
+
354
+
248
355
 
249
- <div class="method-description">
250
-
251
- <p>Options are passed straight through to ::TweetStream and ::Twitter, but the
252
- :username is ours and important.</p>
253
-
356
+
357
+ <span class="summary_desc"><div class='inline'><p>
358
+ Replies to a tweet using the appropriate mentions.
359
+ </p>
360
+ </div></span>
361
+
362
+ </li>
254
363
 
255
-
256
- <div class="method-source-code" id="new-source">
257
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 249</span>
258
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>={})
259
- <span class="ruby-identifier">defaults</span> = { <span class="ruby-value">:username</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>,
260
- <span class="ruby-value">:consumer_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:consumer_secret</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>,
261
- <span class="ruby-value">:oauth_token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:oauth_token_secret</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>,
262
- <span class="ruby-value">:auth_method</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:oauth</span> }
263
-
264
- <span class="ruby-ivar">@opts</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
265
-
266
- <span class="ruby-constant">DirectMessage</span>.<span class="ruby-identifier">ensure_index</span>(<span class="ruby-string">'raw.id'</span>, <span class="ruby-value">:unique</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>)
267
- <span class="ruby-ivar">@username</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-value">:username</span>]
268
- <span class="ruby-ivar">@client</span> = <span class="ruby-constant">Object</span><span class="ruby-operator">::</span><span class="ruby-constant">Twitter</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@opts</span>)
269
- <span class="ruby-keyword">end</span></pre>
270
- </div><!-- new-source -->
271
-
272
- </div>
364
+
365
+ <li class="public ">
366
+ <span class="summary_signature">
367
+
368
+ <a href="#reply_header-instance_method" title="#reply_header (instance method)">- (Object) <strong>reply_header</strong>(tweet) </a>
369
+
370
+
371
+
372
+ </span>
373
+
374
+
375
+
376
+
377
+
378
+
273
379
 
274
-
380
+
381
+ <span class="summary_desc"><div class='inline'><p>
382
+ Constructs the appropriate series of mentions for a reply to this tweet.
383
+ </p>
384
+ </div></span>
385
+
386
+ </li>
275
387
 
276
-
277
- </div><!-- new-method -->
388
+
389
+ <li class="public ">
390
+ <span class="summary_signature">
391
+
392
+ <a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
393
+
278
394
 
279
395
 
280
- </section><!-- public-class-method-details -->
396
+ </span>
397
+
398
+
281
399
 
282
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
283
- <h3 class="section-header">Public Instance Methods</h3>
400
+
401
+
402
+
403
+
404
+
405
+ <span class="summary_desc"><div class='inline'><p>
406
+ Starts our TweetStream client running.
407
+ </p>
408
+ </div></span>
409
+
410
+ </li>
284
411
 
412
+
413
+ <li class="public ">
414
+ <span class="summary_signature">
415
+
416
+ <a href="#send-instance_method" title="#send (instance method)">- (Object) <strong>send</strong>(resp) </a>
285
417
 
286
- <div id="method-i-handle_message" class="method-detail ">
287
-
288
- <div class="method-heading">
289
- <span class="method-name">handle_message</span><span
290
- class="method-args">(message)</span>
291
- <span class="method-click-advice">click to toggle source</span>
292
- </div>
293
-
294
418
 
295
- <div class="method-description">
296
-
297
- <p>Stores a DM and creates a matching <a href="../Request.html">Request</a> as
298
- needed.</p>
299
-
419
+
420
+ </span>
421
+
422
+
423
+
424
+
425
+
426
+
300
427
 
301
-
302
- <div class="method-source-code" id="handle_message-source">
303
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 174</span>
304
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">handle_message</span>(<span class="ruby-identifier">message</span>)
305
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">sender</span>.<span class="ruby-identifier">screen_name</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@username</span>
306
- <span class="ruby-identifier">handle_request</span>(<span class="ruby-constant">DirectMessage</span>.<span class="ruby-identifier">from</span>(<span class="ruby-identifier">message</span>).<span class="ruby-identifier">make_request</span>)
307
- <span class="ruby-keyword">end</span></pre>
308
- </div><!-- handle_message-source -->
309
-
310
- </div>
428
+
429
+ <span class="summary_desc"><div class='inline'><p>
430
+ Sends a Twitter-sourced Response to the appropriate target.
431
+ </p>
432
+ </div></span>
433
+
434
+ </li>
311
435
 
312
-
436
+
437
+ </ul>
438
+
313
439
 
314
-
315
- </div><!-- handle_message-method -->
316
440
 
317
-
318
- <div id="method-i-handle_request" class="method-detail ">
319
-
320
- <div class="method-heading">
321
- <span class="method-name">handle_request</span><span
322
- class="method-args">(req)</span>
323
- <span class="method-click-advice">click to toggle source</span>
324
- </div>
325
-
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="../Evented.html" title="Safubot::Evented (module)">Evented</a></span></h3>
449
+ <p class="inherited"><span class='object_link'><a href="../Evented.html#bind-instance_method" title="Safubot::Evented#bind (method)">#bind</a></span>, <span class='object_link'><a href="../Evented.html#emit-instance_method" title="Safubot::Evented#emit (method)">#emit</a></span>, <span class='object_link'><a href="../Evented.html#on-instance_method" title="Safubot::Evented#on (method)">#on</a></span>, <span class='object_link'><a href="../Evented.html#once-instance_method" title="Safubot::Evented#once (method)">#once</a></span>, <span class='object_link'><a href="../Evented.html#unbind-instance_method" title="Safubot::Evented#unbind (method)">#unbind</a></span></p>
450
+ <div id="constructor_details" class="method_details_list">
451
+ <h2>Constructor Details</h2>
452
+
453
+ <div class="method_details first">
454
+ <p class="signature first" id="initialize-instance_method">
455
+
456
+ - (<tt><span class='object_link'><a href="" title="Safubot::Twitter::Bot (class)">Bot</a></span></tt>) <strong>initialize</strong>(options = {})
457
+
326
458
 
327
- <div class="method-description">
328
-
329
- <p>Emit a request event unless the request is already processed.</p>
330
-
459
+
460
+ </p><div class="docstring">
461
+ <div class="discussion">
462
+ <p>
463
+ Options are passed straight through to ::TweetStream and ::Twitter, but the
464
+ :username is ours and important.
465
+ </p>
331
466
 
332
-
333
- <div class="method-source-code" id="handle_request-source">
334
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 169</span>
335
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">req</span>)
336
- <span class="ruby-identifier">emit</span>(<span class="ruby-value">:request</span>, <span class="ruby-identifier">req</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">req</span>.<span class="ruby-identifier">processed</span>
337
- <span class="ruby-keyword">end</span></pre>
338
- </div><!-- handle_request-source -->
339
-
340
- </div>
341
467
 
342
-
468
+ </div>
469
+ </div>
470
+ <div class="tags">
471
+
343
472
 
344
-
345
- </div><!-- handle_request-method -->
473
+ </div><table class="source_code">
474
+ <tr>
475
+ <td>
476
+ <pre class="lines">
477
+
478
+
479
+ 265
480
+ 266
481
+ 267
482
+ 268
483
+ 269
484
+ 270
485
+ 271
486
+ 272
487
+ 273
488
+ 274
489
+ 275
490
+ 276</pre>
491
+ </td>
492
+ <td>
493
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 265</span>
494
+
495
+ <span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
496
+ <span class='id defaults'>defaults</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:username</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span>
497
+ <span class='symbol'>:consumer_key</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:consumer_secret</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span>
498
+ <span class='symbol'>:oauth_token</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:oauth_token_secret</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span>
499
+ <span class='symbol'>:auth_method</span> <span class='op'>=&gt;</span> <span class='symbol'>:oauth</span> <span class='rbrace'>}</span>
500
+
501
+ <span class='ivar'>@opts</span> <span class='op'>=</span> <span class='id defaults'>defaults</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='id options'>options</span><span class='rparen'>)</span>
502
+
503
+ <span class='const'>DirectMessage</span><span class='period'>.</span><span class='id ensure_index'>ensure_index</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>raw.id</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:unique</span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='rparen'>)</span>
504
+ <span class='ivar'>@username</span> <span class='op'>=</span> <span class='ivar'>@opts</span><span class='lbracket'>[</span><span class='symbol'>:username</span><span class='rbracket'>]</span>
505
+ <span class='ivar'>@client</span> <span class='op'>=</span> <span class='const'>Object</span><span class='op'>::</span><span class='const'>Twitter</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='ivar'>@opts</span><span class='rparen'>)</span>
506
+ <span class='kw'>end</span></pre>
507
+ </td>
508
+ </tr>
509
+ </table>
510
+ </div>
511
+
512
+ </div>
346
513
 
514
+ <div id="instance_attr_details" class="attr_details">
515
+ <h2>Instance Attribute Details</h2>
347
516
 
348
- <div id="method-i-handle_tweet" class="method-detail ">
349
-
350
- <div class="method-heading">
351
- <span class="method-name">handle_tweet</span><span
352
- class="method-args">(status)</span>
353
- <span class="method-click-advice">click to toggle source</span>
354
- </div>
355
-
517
+
518
+ <span id=""></span>
519
+ <span id="client-instance_method"></span>
520
+ <div class="method_details first">
521
+ <p class="signature first" id="client-instance_method">
522
+
523
+ - (<tt>Object</tt>) <strong>client</strong> <span class="extras">(readonly)</span>
524
+
356
525
 
357
- <div class="method-description">
358
-
359
- <p>Stores a tweet. If this tweet is directed at us, create a matching <a
360
- href="../Request.html">Request</a>. Otherwise, emit a :timeline event.</p>
361
-
526
+
527
+ </p><div class="docstring">
528
+ <div class="discussion">
529
+ <p>
530
+ Returns the value of attribute client
531
+ </p>
362
532
 
363
-
364
- <div class="method-source-code" id="handle_tweet-source">
365
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 181</span>
366
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">handle_tweet</span>(<span class="ruby-identifier">status</span>)
367
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">screen_name</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@username</span>
368
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/@#{@username}/</span>)
369
- <span class="ruby-identifier">handle_request</span>(<span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">from</span>(<span class="ruby-identifier">status</span>).<span class="ruby-identifier">make_request</span>)
370
- <span class="ruby-keyword">else</span>
371
- <span class="ruby-identifier">emit</span>(<span class="ruby-value">:timeline</span>, <span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">from</span>(<span class="ruby-identifier">status</span>))
372
- <span class="ruby-keyword">end</span>
373
- <span class="ruby-keyword">end</span></pre>
374
- </div><!-- handle_tweet-source -->
375
-
376
- </div>
377
533
 
378
-
534
+ </div>
535
+ </div>
536
+ <div class="tags">
537
+
379
538
 
380
-
381
- </div><!-- handle_tweet-method -->
539
+ </div><table class="source_code">
540
+ <tr>
541
+ <td>
542
+ <pre class="lines">
543
+
544
+
545
+ 159
546
+ 160
547
+ 161</pre>
548
+ </td>
549
+ <td>
550
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 159</span>
551
+
552
+ <span class='kw'>def</span> <span class='id client'>client</span>
553
+ <span class='ivar'>@client</span>
554
+ <span class='kw'>end</span></pre>
555
+ </td>
556
+ </tr>
557
+ </table>
558
+ </div>
559
+
560
+
561
+ <span id=""></span>
562
+ <span id="opts-instance_method"></span>
563
+ <div class="method_details ">
564
+ <p class="signature " id="opts-instance_method">
565
+
566
+ - (<tt>Object</tt>) <strong>opts</strong> <span class="extras">(readonly)</span>
567
+
568
+
569
+
570
+ </p><div class="docstring">
571
+ <div class="discussion">
572
+ <p>
573
+ Returns the value of attribute opts
574
+ </p>
382
575
 
576
+
577
+ </div>
578
+ </div>
579
+ <div class="tags">
580
+
581
+
582
+ </div><table class="source_code">
583
+ <tr>
584
+ <td>
585
+ <pre class="lines">
586
+
587
+
588
+ 159
589
+ 160
590
+ 161</pre>
591
+ </td>
592
+ <td>
593
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 159</span>
594
+
595
+ <span class='kw'>def</span> <span class='id opts'>opts</span>
596
+ <span class='ivar'>@opts</span>
597
+ <span class='kw'>end</span></pre>
598
+ </td>
599
+ </tr>
600
+ </table>
601
+ </div>
383
602
 
384
- <div id="method-i-pull" class="method-detail ">
385
-
386
- <div class="method-heading">
387
- <span class="method-name">pull</span><span
388
- class="method-args">()</span>
389
- <span class="method-click-advice">click to toggle source</span>
390
- </div>
391
-
603
+
604
+ <span id=""></span>
605
+ <span id="username-instance_method"></span>
606
+ <div class="method_details ">
607
+ <p class="signature " id="username-instance_method">
608
+
609
+ - (<tt>Object</tt>) <strong>username</strong> <span class="extras">(readonly)</span>
610
+
392
611
 
393
- <div class="method-description">
394
-
395
- <p>Pulls DMs and mentions using the AJAX API. Used in tandem with the
396
- streaming API to ensure we don’t miss too much while we’re offline.</p>
397
-
612
+
613
+ </p><div class="docstring">
614
+ <div class="discussion">
615
+ <p>
616
+ Returns the value of attribute username
617
+ </p>
398
618
 
399
-
400
- <div class="method-source-code" id="pull-source">
401
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 204</span>
402
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">pull</span>
403
- <span class="ruby-keyword">begin</span>
404
- <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">direct_messages</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">message</span><span class="ruby-operator">|</span>
405
- <span class="ruby-identifier">handle_message</span>(<span class="ruby-identifier">message</span>)
406
- <span class="ruby-keyword">end</span>
407
-
408
- <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">mentions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mention</span><span class="ruby-operator">|</span>
409
- <span class="ruby-identifier">handle_tweet</span>(<span class="ruby-identifier">mention</span>)
410
- <span class="ruby-keyword">end</span>
411
- <span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Twitter</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">ServiceUnavailable</span>
412
- <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-string">&quot;Twitter: Couldn't pull tweets due to temporary service unavailability.&quot;</span>
413
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
414
- <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;Twitter: Unhandled error: #{e}\n#{e.backtrace.join(&quot;\n\t&quot;)}&quot;</span>
415
- <span class="ruby-keyword">end</span>
416
- <span class="ruby-keyword">end</span></pre>
417
- </div><!-- pull-source -->
418
-
419
- </div>
420
619
 
421
-
620
+ </div>
621
+ </div>
622
+ <div class="tags">
623
+
624
+
625
+ </div><table class="source_code">
626
+ <tr>
627
+ <td>
628
+ <pre class="lines">
629
+
630
+
631
+ 159
632
+ 160
633
+ 161</pre>
634
+ </td>
635
+ <td>
636
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 159</span>
637
+
638
+ <span class='kw'>def</span> <span class='id username'>username</span>
639
+ <span class='ivar'>@username</span>
640
+ <span class='kw'>end</span></pre>
641
+ </td>
642
+ </tr>
643
+ </table>
644
+ </div>
645
+
646
+ </div>
422
647
 
423
-
424
- </div><!-- pull-method -->
425
648
 
649
+ <div id="instance_method_details" class="method_details_list">
650
+ <h2>Instance Method Details</h2>
651
+
426
652
 
427
- <div id="method-i-reply" class="method-detail ">
428
-
429
- <div class="method-heading">
430
- <span class="method-name">reply</span><span
431
- class="method-args">(tweet, text)</span>
432
- <span class="method-click-advice">click to toggle source</span>
433
- </div>
434
-
653
+ <div class="method_details first">
654
+ <p class="signature first" id="handle_message-instance_method">
655
+
656
+ - (<tt>Object</tt>) <strong>handle_message</strong>(message)
657
+
435
658
 
436
- <div class="method-description">
437
-
438
- <p>Replies to a tweet using the appropriate mentions. @param tweet A <a
439
- href="Tweet.html">Tweet</a> object to respond to. @param text The response
440
- text.</p>
441
-
659
+
660
+ </p><div class="docstring">
661
+ <div class="discussion">
662
+ <p>
663
+ Stores a DM and creates a matching Request as needed.
664
+ </p>
442
665
 
443
-
444
- <div class="method-source-code" id="reply-source">
445
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 198</span>
446
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">reply</span>(<span class="ruby-identifier">tweet</span>, <span class="ruby-identifier">text</span>)
447
- <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">update</span>(<span class="ruby-node">&quot;#{reply_header(tweet)} #{text}&quot;</span>, <span class="ruby-value">:in_reply_to_status_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">tweet</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'id'</span>])
448
- <span class="ruby-keyword">end</span></pre>
449
- </div><!-- reply-source -->
450
-
451
- </div>
452
666
 
453
-
667
+ </div>
668
+ </div>
669
+ <div class="tags">
670
+
671
+
672
+ </div><table class="source_code">
673
+ <tr>
674
+ <td>
675
+ <pre class="lines">
676
+
677
+
678
+ 179
679
+ 180
680
+ 181
681
+ 182</pre>
682
+ </td>
683
+ <td>
684
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 179</span>
685
+
686
+ <span class='kw'>def</span> <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span>
687
+ <span class='kw'>return</span> <span class='kw'>if</span> <span class='id message'>message</span><span class='period'>.</span><span class='id sender'>sender</span><span class='period'>.</span><span class='id screen_name'>screen_name</span> <span class='op'>==</span> <span class='ivar'>@username</span>
688
+ <span class='const'>DirectMessage</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span><span class='period'>.</span><span class='id make_request'>make_request</span>
689
+ <span class='kw'>end</span></pre>
690
+ </td>
691
+ </tr>
692
+ </table>
693
+ </div>
694
+
695
+ <div class="method_details ">
696
+ <p class="signature " id="handle_request-instance_method">
697
+
698
+ - (<tt>Object</tt>) <strong>handle_request</strong>(req)
699
+
454
700
 
455
-
456
- </div><!-- reply-method -->
701
+
702
+ </p><div class="docstring">
703
+ <div class="discussion">
704
+ <p>
705
+ Emit a request event unless the request is already processed.
706
+ </p>
707
+
708
+
709
+ </div>
710
+ </div>
711
+ <div class="tags">
712
+
457
713
 
714
+ </div><table class="source_code">
715
+ <tr>
716
+ <td>
717
+ <pre class="lines">
718
+
719
+
720
+ 174
721
+ 175
722
+ 176</pre>
723
+ </td>
724
+ <td>
725
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 174</span>
726
+
727
+ <span class='kw'>def</span> <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='id req'>req</span><span class='rparen'>)</span>
728
+ <span class='id emit'>emit</span><span class='lparen'>(</span><span class='symbol'>:request</span><span class='comma'>,</span> <span class='id req'>req</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id req'>req</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='op'>||</span> <span class='id req'>req</span><span class='period'>.</span><span class='id processed'>processed</span>
729
+ <span class='kw'>end</span></pre>
730
+ </td>
731
+ </tr>
732
+ </table>
733
+ </div>
458
734
 
459
- <div id="method-i-reply_header" class="method-detail ">
460
-
461
- <div class="method-heading">
462
- <span class="method-name">reply_header</span><span
463
- class="method-args">(tweet)</span>
464
- <span class="method-click-advice">click to toggle source</span>
465
- </div>
466
-
735
+ <div class="method_details ">
736
+ <p class="signature " id="handle_tweet-instance_method">
737
+
738
+ - (<tt>Object</tt>) <strong>handle_tweet</strong>(status)
739
+
467
740
 
468
- <div class="method-description">
469
-
470
- <p>Constructs the appropriate series of mentions for a reply to this tweet.</p>
471
-
741
+
742
+ </p><div class="docstring">
743
+ <div class="discussion">
744
+ <p>
745
+ Stores a tweet. If this tweet is directed at us, create a matching Request.
746
+ Otherwise, emit a :timeline event.
747
+ </p>
472
748
 
473
-
474
- <div class="method-source-code" id="reply_header-source">
475
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 191</span>
476
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">reply_header</span>(<span class="ruby-identifier">tweet</span>)
477
- ([<span class="ruby-node">&quot;@#{tweet.username}&quot;</span>] <span class="ruby-operator">+</span> (<span class="ruby-identifier">tweet</span>.<span class="ruby-identifier">header_mentions</span> <span class="ruby-operator">-</span> [<span class="ruby-node">&quot;@#{@username}&quot;</span>])).<span class="ruby-identifier">join</span>
478
- <span class="ruby-keyword">end</span></pre>
479
- </div><!-- reply_header-source -->
480
-
481
- </div>
482
749
 
483
-
750
+ </div>
751
+ </div>
752
+ <div class="tags">
753
+
754
+
755
+ </div><table class="source_code">
756
+ <tr>
757
+ <td>
758
+ <pre class="lines">
759
+
760
+
761
+ 186
762
+ 187
763
+ 188
764
+ 189
765
+ 190
766
+ 191
767
+ 192
768
+ 193</pre>
769
+ </td>
770
+ <td>
771
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 186</span>
772
+
773
+ <span class='kw'>def</span> <span class='id handle_tweet'>handle_tweet</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span>
774
+ <span class='kw'>return</span> <span class='kw'>if</span> <span class='id status'>status</span><span class='period'>.</span><span class='id user'>user</span><span class='period'>.</span><span class='id screen_name'>screen_name</span> <span class='op'>==</span> <span class='ivar'>@username</span>
775
+ <span class='kw'>if</span> <span class='id status'>status</span><span class='period'>.</span><span class='id text'>text</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='ivar'>@username</span><span class='rbrace'>}</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span>
776
+ <span class='const'>Tweet</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span><span class='period'>.</span><span class='id make_request'>make_request</span>
777
+ <span class='kw'>else</span>
778
+ <span class='id emit'>emit</span><span class='lparen'>(</span><span class='symbol'>:timeline</span><span class='comma'>,</span> <span class='const'>Tweet</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span><span class='rparen'>)</span>
779
+ <span class='kw'>end</span>
780
+ <span class='kw'>end</span></pre>
781
+ </td>
782
+ </tr>
783
+ </table>
784
+ </div>
785
+
786
+ <div class="method_details ">
787
+ <p class="signature " id="pull-instance_method">
788
+
789
+ - (<tt>Object</tt>) <strong>pull</strong>
790
+
791
+
792
+
793
+ </p><div class="docstring">
794
+ <div class="discussion">
795
+ <p>
796
+ Pulls DMs and mentions using the AJAX API. Used in tandem with the
797
+ streaming API to ensure we don&#8217;t miss too much while we&#8217;re
798
+ offline.
799
+ </p>
484
800
 
485
-
486
- </div><!-- reply_header-method -->
487
801
 
802
+ </div>
803
+ </div>
804
+ <div class="tags">
805
+
806
+
807
+ </div><table class="source_code">
808
+ <tr>
809
+ <td>
810
+ <pre class="lines">
811
+
812
+
813
+ 209
814
+ 210
815
+ 211
816
+ 212
817
+ 213
818
+ 214
819
+ 215
820
+ 216
821
+ 217
822
+ 218
823
+ 219
824
+ 220
825
+ 221
826
+ 222
827
+ 223</pre>
828
+ </td>
829
+ <td>
830
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 209</span>
831
+
832
+ <span class='kw'>def</span> <span class='id pull'>pull</span>
833
+ <span class='kw'>begin</span>
834
+ <span class='ivar'>@client</span><span class='period'>.</span><span class='id direct_messages'>direct_messages</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id message'>message</span><span class='op'>|</span>
835
+ <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span>
836
+ <span class='kw'>end</span>
837
+
838
+ <span class='ivar'>@client</span><span class='period'>.</span><span class='id mentions'>mentions</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id mention'>mention</span><span class='op'>|</span>
839
+ <span class='id handle_tweet'>handle_tweet</span><span class='lparen'>(</span><span class='id mention'>mention</span><span class='rparen'>)</span>
840
+ <span class='kw'>end</span>
841
+ <span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>Twitter</span><span class='op'>::</span><span class='const'>Error</span><span class='op'>::</span><span class='const'>ServiceUnavailable</span>
842
+ <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Twitter: Couldn't pull tweets due to temporary service unavailability.</span><span class='tstring_end'>&quot;</span></span>
843
+ <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id e'>e</span>
844
+ <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Twitter: Unhandled error: </span><span class='embexpr_beg'>#{</span><span class='id e'>e</span><span class='rbrace'>}</span><span class='tstring_content'>\n</span><span class='embexpr_beg'>#{</span><span class='id e'>e</span><span class='period'>.</span><span class='id backtrace'>backtrace</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n\t</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
845
+ <span class='kw'>end</span>
846
+ <span class='kw'>end</span></pre>
847
+ </td>
848
+ </tr>
849
+ </table>
850
+ </div>
488
851
 
489
- <div id="method-i-run" class="method-detail ">
490
-
491
- <div class="method-heading">
492
- <span class="method-name">run</span><span
493
- class="method-args">()</span>
494
- <span class="method-click-advice">click to toggle source</span>
495
- </div>
496
-
852
+ <div class="method_details ">
853
+ <p class="signature " id="reply-instance_method">
854
+
855
+ - (<tt>Object</tt>) <strong>reply</strong>(tweet, text)
856
+
497
857
 
498
- <div class="method-description">
499
-
500
- <p>Starts our TweetStream client running.</p>
501
-
858
+
859
+ </p><div class="docstring">
860
+ <div class="discussion">
861
+ <p>
862
+ Replies to a tweet using the appropriate mentions.
863
+ </p>
502
864
 
503
-
504
- <div class="method-source-code" id="run-source">
505
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 221</span>
506
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>
507
- <span class="ruby-ivar">@stream</span> = <span class="ruby-constant">TweetStream</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@opts</span>)
508
-
509
- <span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">on_direct_message</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">message</span><span class="ruby-operator">|</span>
510
- <span class="ruby-identifier">handle_message</span>(<span class="ruby-identifier">message</span>)
511
- <span class="ruby-keyword">end</span>
512
-
513
- <span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">on_error</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">err</span><span class="ruby-operator">|</span>
514
- <span class="ruby-comment"># HACK (Mispy): For some reason this is a String instead of an Exception.</span>
515
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">err</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/invalid status code: 401/</span>)
516
- <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span>(<span class="ruby-string">&quot;TweetStream authentication failure!&quot;</span>)
517
- <span class="ruby-keyword">else</span>
518
- <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;Unhandled TweetStream error: #{err}&quot;</span>
519
- <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span> <span class="ruby-string">&quot;Reinitialising TweetStream in 5 seconds.&quot;</span>
520
- <span class="ruby-identifier">sleep</span> <span class="ruby-value">5</span>
521
- <span class="ruby-identifier">run</span>
522
- <span class="ruby-keyword">end</span>
523
- <span class="ruby-keyword">end</span>
524
-
525
- <span class="ruby-ivar">@stream</span>.<span class="ruby-identifier">userstream</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span>
526
- <span class="ruby-identifier">handle_tweet</span>(<span class="ruby-identifier">status</span>)
527
- <span class="ruby-keyword">end</span>
528
-
529
- <span class="ruby-constant">Log</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;Twitter client is online at @#{@username} :3&quot;</span>)
530
- <span class="ruby-keyword">end</span></pre>
531
- </div><!-- run-source -->
532
-
533
- </div>
534
865
 
535
-
866
+ </div>
867
+ </div>
868
+ <div class="tags">
869
+ <h3>Parameters:</h3>
870
+ <ul class="param">
871
+
872
+ <li>
873
+
874
+ <span class='name'>tweet</span>
875
+
876
+
877
+ <span class='type'></span>
878
+
879
+
880
+
881
+ &mdash;
882
+ <div class='inline'><p>
883
+ A Tweet object to respond to.
884
+ </p>
885
+ </div>
886
+
887
+ </li>
888
+
889
+ <li>
890
+
891
+ <span class='name'>text</span>
892
+
893
+
894
+ <span class='type'></span>
895
+
896
+
897
+
898
+ &mdash;
899
+ <div class='inline'><p>
900
+ The response text.
901
+ </p>
902
+ </div>
903
+
904
+ </li>
905
+
906
+ </ul>
907
+
908
+
909
+ </div><table class="source_code">
910
+ <tr>
911
+ <td>
912
+ <pre class="lines">
536
913
 
537
-
538
- </div><!-- run-method -->
539
914
 
915
+ 203
916
+ 204
917
+ 205</pre>
918
+ </td>
919
+ <td>
920
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 203</span>
921
+
922
+ <span class='kw'>def</span> <span class='id reply'>reply</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='comma'>,</span> <span class='id text'>text</span><span class='rparen'>)</span>
923
+ <span class='ivar'>@client</span><span class='period'>.</span><span class='id update'>update</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id reply_header'>reply_header</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id text'>text</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:in_reply_to_status_id</span> <span class='op'>=&gt;</span> <span class='id tweet'>tweet</span><span class='period'>.</span><span class='id raw'>raw</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
924
+ <span class='kw'>end</span></pre>
925
+ </td>
926
+ </tr>
927
+ </table>
928
+ </div>
540
929
 
541
- <div id="method-i-send" class="method-detail ">
542
-
543
- <div class="method-heading">
544
- <span class="method-name">send</span><span
545
- class="method-args">(resp)</span>
546
- <span class="method-click-advice">click to toggle source</span>
547
- </div>
548
-
930
+ <div class="method_details ">
931
+ <p class="signature " id="reply_header-instance_method">
932
+
933
+ - (<tt>Object</tt>) <strong>reply_header</strong>(tweet)
934
+
549
935
 
550
- <div class="method-description">
551
-
552
- <p>Sends a Twitter-sourced <a href="../Response.html">Response</a> to the
553
- appropriate target.</p>
554
-
936
+
937
+ </p><div class="docstring">
938
+ <div class="discussion">
939
+ <p>
940
+ Constructs the appropriate series of mentions for a reply to this tweet.
941
+ </p>
555
942
 
556
-
557
- <div class="method-source-code" id="send-source">
558
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 157</span>
559
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">resp</span>)
560
- <span class="ruby-identifier">source</span> = <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">source</span>
561
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DirectMessage</span>)
562
- <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">direct_message_create</span>(<span class="ruby-identifier">source</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'sender'</span>][<span class="ruby-string">'screen_name'</span>], <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">text</span>)
563
- <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Tweet</span>)
564
- <span class="ruby-identifier">reply</span>(<span class="ruby-node">&quot;#{source.header_mentions.join(' ')} #{resp.text}&quot;</span>)
565
- <span class="ruby-keyword">else</span>
566
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-node">&quot;Don't know how to send response to a #{req.source.class}!&quot;</span>
567
- <span class="ruby-keyword">end</span>
568
- <span class="ruby-keyword">end</span></pre>
569
- </div><!-- send-source -->
570
-
571
- </div>
572
943
 
573
-
944
+ </div>
945
+ </div>
946
+ <div class="tags">
947
+
948
+
949
+ </div><table class="source_code">
950
+ <tr>
951
+ <td>
952
+ <pre class="lines">
953
+
954
+
955
+ 196
956
+ 197
957
+ 198</pre>
958
+ </td>
959
+ <td>
960
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 196</span>
961
+
962
+ <span class='kw'>def</span> <span class='id reply_header'>reply_header</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='rparen'>)</span>
963
+ <span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id tweet'>tweet</span><span class='period'>.</span><span class='id username'>username</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='period'>.</span><span class='id header_mentions'>header_mentions</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='ivar'>@username</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id join'>join</span>
964
+ <span class='kw'>end</span></pre>
965
+ </td>
966
+ </tr>
967
+ </table>
968
+ </div>
969
+
970
+ <div class="method_details ">
971
+ <p class="signature " id="run-instance_method">
972
+
973
+ - (<tt>Object</tt>) <strong>run</strong>
974
+
975
+
976
+
977
+ </p><div class="docstring">
978
+ <div class="discussion">
979
+ <p>
980
+ Starts our TweetStream client running.
981
+ </p>
982
+
574
983
 
575
-
576
- </div><!-- send-method -->
984
+ </div>
985
+ </div>
986
+ <div class="tags">
987
+
577
988
 
989
+ </div><table class="source_code">
990
+ <tr>
991
+ <td>
992
+ <pre class="lines">
993
+
994
+
995
+ 226
996
+ 227
997
+ 228
998
+ 229
999
+ 230
1000
+ 231
1001
+ 232
1002
+ 233
1003
+ 234
1004
+ 235
1005
+ 236
1006
+ 237
1007
+ 238
1008
+ 239
1009
+ 240
1010
+ 241
1011
+ 242
1012
+ 243
1013
+ 244
1014
+ 245
1015
+ 246
1016
+ 247
1017
+ 248
1018
+ 249
1019
+ 250
1020
+ 251
1021
+ 252
1022
+ 253
1023
+ 254
1024
+ 255
1025
+ 256
1026
+ 257
1027
+ 258
1028
+ 259
1029
+ 260
1030
+ 261</pre>
1031
+ </td>
1032
+ <td>
1033
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 226</span>
1034
+
1035
+ <span class='kw'>def</span> <span class='id run'>run</span>
1036
+ <span class='const'>Fiber</span><span class='period'>.</span><span class='id new'>new</span> <span class='kw'>do</span>
1037
+ <span class='ivar'>@stream</span> <span class='op'>=</span> <span class='const'>TweetStream</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='ivar'>@opts</span><span class='rparen'>)</span>
1038
+
1039
+ <span class='ivar'>@stream</span><span class='period'>.</span><span class='id on_direct_message'>on_direct_message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id message'>message</span><span class='op'>|</span>
1040
+ <span class='id dm'>dm</span> <span class='op'>=</span> <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span>
1041
+ <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='id dm'>dm</span><span class='period'>.</span><span class='id request'>request</span><span class='rparen'>)</span>
1042
+ <span class='kw'>end</span>
1043
+
1044
+ <span class='ivar'>@stream</span><span class='period'>.</span><span class='id on_error'>on_error</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id err'>err</span><span class='op'>|</span>
1045
+ <span class='comment'># HACK (Mispy): For some reason this is a String instead of an Exception.
1046
+ </span><span class='kw'>if</span> <span class='id err'>err</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>invalid status code: 401</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
1047
+ <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream authentication failure!</span><span class='tstring_end'>&quot;</span></span>
1048
+ <span class='kw'>else</span>
1049
+ <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unhandled TweetStream error: </span><span class='embexpr_beg'>#{</span><span class='gvar'>$!</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='gvar'>$@</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1050
+ <span class='kw'>end</span>
1051
+ <span class='kw'>end</span>
1052
+
1053
+ <span class='kw'>begin</span>
1054
+ <span class='ivar'>@stream</span><span class='period'>.</span><span class='id userstream'>userstream</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id status'>status</span><span class='op'>|</span>
1055
+ <span class='id tweet'>tweet</span> <span class='op'>=</span> <span class='id handle_tweet'>handle_tweet</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span>
1056
+ <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='period'>.</span><span class='id request'>request</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id tweet'>tweet</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Tweet</span>
1057
+ <span class='kw'>end</span>
1058
+ <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id e'>e</span>
1059
+ <span class='kw'>if</span> <span class='id e'>e</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Interrupt</span>
1060
+ <span class='id exit'>exit</span>
1061
+ <span class='kw'>else</span>
1062
+ <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream event loop exited: </span><span class='embexpr_beg'>#{</span><span class='gvar'>$!</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='gvar'>$@</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
1063
+ <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Reinitialising TweetStream in 5 seconds.</span><span class='tstring_end'>&quot;</span></span>
1064
+ <span class='const'>EM</span><span class='op'>::</span><span class='const'>Timer</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id run'>run</span> <span class='rbrace'>}</span>
1065
+ <span class='kw'>end</span>
1066
+ <span class='kw'>end</span>
1067
+
1068
+ <span class='const'>Log</span><span class='period'>.</span><span class='id info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Twitter client is online at @</span><span class='embexpr_beg'>#{</span><span class='ivar'>@username</span><span class='rbrace'>}</span><span class='tstring_content'> :3</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1069
+ <span class='kw'>end</span><span class='period'>.</span><span class='id resume'>resume</span>
1070
+ <span class='kw'>end</span></pre>
1071
+ </td>
1072
+ </tr>
1073
+ </table>
1074
+ </div>
578
1075
 
579
- </section><!-- public-instance-method-details -->
1076
+ <div class="method_details ">
1077
+ <p class="signature " id="send-instance_method">
1078
+
1079
+ - (<tt>Object</tt>) <strong>send</strong>(resp)
1080
+
1081
+
580
1082
 
581
- </section><!-- 5Buntitled-5D -->
1083
+ </p><div class="docstring">
1084
+ <div class="discussion">
1085
+ <p>
1086
+ Sends a Twitter-sourced Response to the appropriate target.
1087
+ </p>
582
1088
 
583
- </div><!-- documentation -->
584
1089
 
1090
+ </div>
1091
+ </div>
1092
+ <div class="tags">
1093
+
585
1094
 
586
- <footer id="validator-badges">
587
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
588
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
589
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
590
- </footer>
1095
+ </div><table class="source_code">
1096
+ <tr>
1097
+ <td>
1098
+ <pre class="lines">
1099
+
1100
+
1101
+ 162
1102
+ 163
1103
+ 164
1104
+ 165
1105
+ 166
1106
+ 167
1107
+ 168
1108
+ 169
1109
+ 170
1110
+ 171</pre>
1111
+ </td>
1112
+ <td>
1113
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 162</span>
1114
+
1115
+ <span class='kw'>def</span> <span class='id send'>send</span><span class='lparen'>(</span><span class='id resp'>resp</span><span class='rparen'>)</span>
1116
+ <span class='id source'>source</span> <span class='op'>=</span> <span class='id resp'>resp</span><span class='period'>.</span><span class='id request'>request</span><span class='period'>.</span><span class='id source'>source</span>
1117
+ <span class='kw'>if</span> <span class='id source'>source</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>DirectMessage</span><span class='rparen'>)</span>
1118
+ <span class='ivar'>@client</span><span class='period'>.</span><span class='id direct_message_create'>direct_message_create</span><span class='lparen'>(</span><span class='id source'>source</span><span class='period'>.</span><span class='id raw'>raw</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sender</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>screen_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id resp'>resp</span><span class='period'>.</span><span class='id text'>text</span><span class='rparen'>)</span>
1119
+ <span class='kw'>elsif</span> <span class='id source'>source</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Tweet</span><span class='rparen'>)</span>
1120
+ <span class='id reply'>reply</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id source'>source</span><span class='period'>.</span><span class='id header_mentions'>header_mentions</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id resp'>resp</span><span class='period'>.</span><span class='id text'>text</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1121
+ <span class='kw'>else</span>
1122
+ <span class='id raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Don't know how to send response to a </span><span class='embexpr_beg'>#{</span><span class='id req'>req</span><span class='period'>.</span><span class='id source'>source</span><span class='period'>.</span><span class='id class'>class</span><span class='rbrace'>}</span><span class='tstring_content'>!</span><span class='tstring_end'>&quot;</span></span>
1123
+ <span class='kw'>end</span>
1124
+ <span class='kw'>end</span></pre>
1125
+ </td>
1126
+ </tr>
1127
+ </table>
1128
+ </div>
1129
+
1130
+ </div>
591
1131
 
1132
+ </div>
1133
+
1134
+ <div id="footer">
1135
+ Generated on Mon Nov 28 20:20:04 2011 by
1136
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1137
+ 0.7.3 (ruby-1.9.2).
1138
+ </div>
1139
+
1140
+ </body>
1141
+ </html>