safubot 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.md +19 -0
  4. data/README.md +43 -0
  5. data/Rakefile +1 -0
  6. data/doc/Gemfile.html +119 -0
  7. data/doc/Object.html +171 -0
  8. data/doc/Rakefile.html +117 -0
  9. data/doc/Safubot.html +173 -0
  10. data/doc/Safubot/Bot.html +827 -0
  11. data/doc/Safubot/Evented.html +346 -0
  12. data/doc/Safubot/KnownUser.html +344 -0
  13. data/doc/Safubot/Log.html +254 -0
  14. data/doc/Safubot/Query.html +217 -0
  15. data/doc/Safubot/Request.html +201 -0
  16. data/doc/Safubot/Response.html +174 -0
  17. data/doc/Safubot/Test.html +244 -0
  18. data/doc/Safubot/Twitter.html +153 -0
  19. data/doc/Safubot/Twitter/Bot.html +591 -0
  20. data/doc/Safubot/Twitter/DirectMessage.html +327 -0
  21. data/doc/Safubot/Twitter/Tweet.html +522 -0
  22. data/doc/Safubot/XMPP.html +153 -0
  23. data/doc/Safubot/XMPP/Bot.html +403 -0
  24. data/doc/Safubot/XMPP/Message.html +298 -0
  25. data/doc/created.rid +14 -0
  26. data/doc/foo_rb.html +115 -0
  27. data/doc/images/add.png +0 -0
  28. data/doc/images/brick.png +0 -0
  29. data/doc/images/brick_link.png +0 -0
  30. data/doc/images/bug.png +0 -0
  31. data/doc/images/bullet_black.png +0 -0
  32. data/doc/images/bullet_toggle_minus.png +0 -0
  33. data/doc/images/bullet_toggle_plus.png +0 -0
  34. data/doc/images/date.png +0 -0
  35. data/doc/images/delete.png +0 -0
  36. data/doc/images/find.png +0 -0
  37. data/doc/images/loadingAnimation.gif +0 -0
  38. data/doc/images/macFFBgHack.png +0 -0
  39. data/doc/images/package.png +0 -0
  40. data/doc/images/page_green.png +0 -0
  41. data/doc/images/page_white_text.png +0 -0
  42. data/doc/images/page_white_width.png +0 -0
  43. data/doc/images/plugin.png +0 -0
  44. data/doc/images/ruby.png +0 -0
  45. data/doc/images/tag_blue.png +0 -0
  46. data/doc/images/tag_green.png +0 -0
  47. data/doc/images/transparent.png +0 -0
  48. data/doc/images/wrench.png +0 -0
  49. data/doc/images/wrench_orange.png +0 -0
  50. data/doc/images/zoom.png +0 -0
  51. data/doc/index.html +112 -0
  52. data/doc/js/darkfish.js +153 -0
  53. data/doc/js/jquery.js +18 -0
  54. data/doc/js/navigation.js +142 -0
  55. data/doc/js/search.js +94 -0
  56. data/doc/js/search_index.js +1 -0
  57. data/doc/js/searcher.js +228 -0
  58. data/doc/lib/safubot/bot_rb.html +115 -0
  59. data/doc/lib/safubot/evented_rb.html +115 -0
  60. data/doc/lib/safubot/known_user_rb.html +115 -0
  61. data/doc/lib/safubot/log_rb.html +115 -0
  62. data/doc/lib/safubot/safubot_rb.html +115 -0
  63. data/doc/lib/safubot/spec/bot_spec_rb.html +115 -0
  64. data/doc/lib/safubot/spec/twitter_spec_rb.html +137 -0
  65. data/doc/lib/safubot/test_helper_rb.html +115 -0
  66. data/doc/lib/safubot/twitter_rb.html +115 -0
  67. data/doc/lib/safubot/version_rb.html +115 -0
  68. data/doc/lib/safubot/xmpp_rb.html +115 -0
  69. data/doc/lib/safubot_rb.html +115 -0
  70. data/doc/rdoc.css +543 -0
  71. data/doc/table_of_contents.html +224 -0
  72. data/lib/safubot.rb +20 -0
  73. data/lib/safubot/bot.rb +177 -0
  74. data/lib/safubot/evented.rb +52 -0
  75. data/lib/safubot/known_user.rb +27 -0
  76. data/lib/safubot/log.rb +21 -0
  77. data/lib/safubot/test_helper.rb +62 -0
  78. data/lib/safubot/twitter.rb +279 -0
  79. data/lib/safubot/version.rb +3 -0
  80. data/lib/safubot/xmpp.rb +144 -0
  81. data/safubot.gemspec +32 -0
  82. data/spec/fixtures/twitter/direct_message +1 -0
  83. data/spec/fixtures/twitter/tweet +1 -0
  84. data/spec/fixtures/xmpp/message +3 -0
  85. data/spec/helper.rb +12 -0
  86. data/spec/safubot/bot_spec.rb +41 -0
  87. data/spec/safubot/evented_spec.rb +45 -0
  88. data/spec/safubot/known_user_spec.rb +22 -0
  89. data/spec/safubot/twitter_spec.rb +60 -0
  90. data/spec/safubot/xmpp_spec.rb +35 -0
  91. metadata +260 -0
@@ -0,0 +1,327 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Class: Safubot::Twitter::DirectMessage</title>
8
+
9
+ <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../../";
13
+ </script>
14
+
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>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link"><a href="../../Object.html">Object</a>
63
+
64
+ </nav>
65
+
66
+ <!-- Included Modules -->
67
+ <nav id="includes-section" class="section">
68
+ <h3 class="section-header">Included Modules</h3>
69
+
70
+ <ul class="link-list">
71
+
72
+
73
+ <li><span class="include">MongoMapper::Document</span>
74
+
75
+
76
+ </ul>
77
+ </nav>
78
+
79
+ <!-- Method Quickref -->
80
+ <nav id="method-list-section" class="section">
81
+ <h3 class="section-header">Methods</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="#method-c-from">::from</a>
86
+
87
+ <li><a href="#method-i-make_request">#make_request</a>
88
+
89
+ <li><a href="#method-i-text">#text</a>
90
+
91
+ <li><a href="#method-i-user">#user</a>
92
+
93
+ </ul>
94
+ </nav>
95
+
96
+ </div>
97
+
98
+ <div id="project-metadata">
99
+ <nav id="fileindex-section" class="section project-section">
100
+ <h3 class="section-header">Pages</h3>
101
+
102
+ <ul>
103
+
104
+ <li class="file"><a href="../../Gemfile.html">Gemfile</a>
105
+
106
+ <li class="file"><a href="../../Rakefile.html">Rakefile</a>
107
+
108
+ </ul>
109
+ </nav>
110
+
111
+ <nav id="classindex-section" class="section project-section">
112
+ <h3 class="section-header">Class and Module Index</h3>
113
+
114
+ <ul class="link-list">
115
+
116
+ <li><a href="../../Safubot.html">Safubot</a>
117
+
118
+ <li><a href="../../Safubot/Bot.html">Safubot::Bot</a>
119
+
120
+ <li><a href="../../Safubot/Evented.html">Safubot::Evented</a>
121
+
122
+ <li><a href="../../Safubot/KnownUser.html">Safubot::KnownUser</a>
123
+
124
+ <li><a href="../../Safubot/Log.html">Safubot::Log</a>
125
+
126
+ <li><a href="../../Safubot/Query.html">Safubot::Query</a>
127
+
128
+ <li><a href="../../Safubot/Request.html">Safubot::Request</a>
129
+
130
+ <li><a href="../../Safubot/Response.html">Safubot::Response</a>
131
+
132
+ <li><a href="../../Safubot/Test.html">Safubot::Test</a>
133
+
134
+ <li><a href="../../Safubot/Twitter.html">Safubot::Twitter</a>
135
+
136
+ <li><a href="../../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
137
+
138
+ <li><a href="../../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
139
+
140
+ <li><a href="../../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
141
+
142
+ <li><a href="../../Safubot/XMPP.html">Safubot::XMPP</a>
143
+
144
+ <li><a href="../../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
145
+
146
+ <li><a href="../../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
147
+
148
+ <li><a href="../../Object.html">Object</a>
149
+
150
+ </ul>
151
+ </nav>
152
+
153
+ </div>
154
+ </nav>
155
+
156
+ <div id="documentation">
157
+ <h1 class="class">class Safubot::Twitter::DirectMessage</h1>
158
+
159
+ <div id="description" class="description">
160
+
161
+ <p><a href="DirectMessage.html">DirectMessage</a> is a <a
162
+ href="../Request.html">Request</a> source. All DirectMessages are made into
163
+ Requests as they are received.</p>
164
+
165
+ </div><!-- description -->
166
+
167
+
168
+
169
+
170
+ <section id="5Buntitled-5D" class="documentation-section">
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <!-- Methods -->
180
+
181
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
182
+ <h3 class="section-header">Public Class Methods</h3>
183
+
184
+
185
+ <div id="method-c-from" class="method-detail ">
186
+
187
+ <div class="method-heading">
188
+ <span class="method-name">from</span><span
189
+ class="method-args">(message)</span>
190
+ <span class="method-click-advice">click to toggle source</span>
191
+ </div>
192
+
193
+
194
+ <div class="method-description">
195
+
196
+ <p>Find or create a <a href="DirectMessage.html">DirectMessage</a>. @param
197
+ message An appropriate ::Twitter or ::TweetStream object.</p>
198
+
199
+
200
+
201
+ <div class="method-source-code" id="from-source">
202
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 128</span>
203
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">from</span>(<span class="ruby-identifier">message</span>)
204
+ <span class="ruby-constant">DirectMessage</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'raw.id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span>
205
+ <span class="ruby-constant">DirectMessage</span>.<span class="ruby-identifier">create</span>(<span class="ruby-value">:raw</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">message</span>[<span class="ruby-string">'attrs'</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">message</span>)
206
+ <span class="ruby-keyword">end</span></pre>
207
+ </div><!-- from-source -->
208
+
209
+ </div>
210
+
211
+
212
+
213
+
214
+ </div><!-- from-method -->
215
+
216
+
217
+ </section><!-- public-class-method-details -->
218
+
219
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
220
+ <h3 class="section-header">Public Instance Methods</h3>
221
+
222
+
223
+ <div id="method-i-make_request" class="method-detail ">
224
+
225
+ <div class="method-heading">
226
+ <span class="method-name">make_request</span><span
227
+ class="method-args">()</span>
228
+ <span class="method-click-advice">click to toggle source</span>
229
+ </div>
230
+
231
+
232
+ <div class="method-description">
233
+
234
+ <p>Finds or creates a <a href="../Request.html">Request</a> sourced from this
235
+ <a href="DirectMessage.html">DirectMessage</a>.</p>
236
+
237
+
238
+
239
+ <div class="method-source-code" id="make_request-source">
240
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 145</span>
241
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">make_request</span>
242
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">request</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Request</span>.<span class="ruby-identifier">create</span>(<span class="ruby-value">:user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">user</span>, <span class="ruby-value">:source</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>, <span class="ruby-value">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">text</span>)
243
+ <span class="ruby-keyword">end</span></pre>
244
+ </div><!-- make_request-source -->
245
+
246
+ </div>
247
+
248
+
249
+
250
+
251
+ </div><!-- make_request-method -->
252
+
253
+
254
+ <div id="method-i-text" class="method-detail ">
255
+
256
+ <div class="method-heading">
257
+ <span class="method-name">text</span><span
258
+ class="method-args">()</span>
259
+ <span class="method-click-advice">click to toggle source</span>
260
+ </div>
261
+
262
+
263
+ <div class="method-description">
264
+
265
+ <p>The plain text.</p>
266
+
267
+
268
+
269
+ <div class="method-source-code" id="text-source">
270
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 135</span>
271
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">text</span>
272
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'text'</span>]
273
+ <span class="ruby-keyword">end</span></pre>
274
+ </div><!-- text-source -->
275
+
276
+ </div>
277
+
278
+
279
+
280
+
281
+ </div><!-- text-method -->
282
+
283
+
284
+ <div id="method-i-user" class="method-detail ">
285
+
286
+ <div class="method-heading">
287
+ <span class="method-name">user</span><span
288
+ class="method-args">()</span>
289
+ <span class="method-click-advice">click to toggle source</span>
290
+ </div>
291
+
292
+
293
+ <div class="method-description">
294
+
295
+ <p>Finds or creates a <a href="../KnownUser.html">KnownUser</a> connected to
296
+ this <a href="DirectMessage.html">DirectMessage</a>.</p>
297
+
298
+
299
+
300
+ <div class="method-source-code" id="user-source">
301
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 140</span>
302
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">user</span>
303
+ <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">by_twitter</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'sender'</span>][<span class="ruby-string">'screen_name'</span>])
304
+ <span class="ruby-keyword">end</span></pre>
305
+ </div><!-- user-source -->
306
+
307
+ </div>
308
+
309
+
310
+
311
+
312
+ </div><!-- user-method -->
313
+
314
+
315
+ </section><!-- public-instance-method-details -->
316
+
317
+ </section><!-- 5Buntitled-5D -->
318
+
319
+ </div><!-- documentation -->
320
+
321
+
322
+ <footer id="validator-badges">
323
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
324
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
325
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
326
+ </footer>
327
+
@@ -0,0 +1,522 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Class: Safubot::Twitter::Tweet</title>
8
+
9
+ <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../../";
13
+ </script>
14
+
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>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link"><a href="../../Object.html">Object</a>
63
+
64
+ </nav>
65
+
66
+ <!-- Included Modules -->
67
+ <nav id="includes-section" class="section">
68
+ <h3 class="section-header">Included Modules</h3>
69
+
70
+ <ul class="link-list">
71
+
72
+
73
+ <li><span class="include">MongoMapper::Document</span>
74
+
75
+
76
+ </ul>
77
+ </nav>
78
+
79
+ <!-- Method Quickref -->
80
+ <nav id="method-list-section" class="section">
81
+ <h3 class="section-header">Methods</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="#method-c-5B-5D">::[]</a>
86
+
87
+ <li><a href="#method-c-from">::from</a>
88
+
89
+ <li><a href="#method-i-header_mentions">#header_mentions</a>
90
+
91
+ <li><a href="#method-i-make_request">#make_request</a>
92
+
93
+ <li><a href="#method-i-original_tweet">#original_tweet</a>
94
+
95
+ <li><a href="#method-i-posted_at">#posted_at</a>
96
+
97
+ <li><a href="#method-i-targetless_text">#targetless_text</a>
98
+
99
+ <li><a href="#method-i-text">#text</a>
100
+
101
+ <li><a href="#method-i-user">#user</a>
102
+
103
+ <li><a href="#method-i-username">#username</a>
104
+
105
+ </ul>
106
+ </nav>
107
+
108
+ </div>
109
+
110
+ <div id="project-metadata">
111
+ <nav id="fileindex-section" class="section project-section">
112
+ <h3 class="section-header">Pages</h3>
113
+
114
+ <ul>
115
+
116
+ <li class="file"><a href="../../Gemfile.html">Gemfile</a>
117
+
118
+ <li class="file"><a href="../../Rakefile.html">Rakefile</a>
119
+
120
+ </ul>
121
+ </nav>
122
+
123
+ <nav id="classindex-section" class="section project-section">
124
+ <h3 class="section-header">Class and Module Index</h3>
125
+
126
+ <ul class="link-list">
127
+
128
+ <li><a href="../../Safubot.html">Safubot</a>
129
+
130
+ <li><a href="../../Safubot/Bot.html">Safubot::Bot</a>
131
+
132
+ <li><a href="../../Safubot/Evented.html">Safubot::Evented</a>
133
+
134
+ <li><a href="../../Safubot/KnownUser.html">Safubot::KnownUser</a>
135
+
136
+ <li><a href="../../Safubot/Log.html">Safubot::Log</a>
137
+
138
+ <li><a href="../../Safubot/Query.html">Safubot::Query</a>
139
+
140
+ <li><a href="../../Safubot/Request.html">Safubot::Request</a>
141
+
142
+ <li><a href="../../Safubot/Response.html">Safubot::Response</a>
143
+
144
+ <li><a href="../../Safubot/Test.html">Safubot::Test</a>
145
+
146
+ <li><a href="../../Safubot/Twitter.html">Safubot::Twitter</a>
147
+
148
+ <li><a href="../../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
149
+
150
+ <li><a href="../../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
151
+
152
+ <li><a href="../../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
153
+
154
+ <li><a href="../../Safubot/XMPP.html">Safubot::XMPP</a>
155
+
156
+ <li><a href="../../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
157
+
158
+ <li><a href="../../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
159
+
160
+ <li><a href="../../Object.html">Object</a>
161
+
162
+ </ul>
163
+ </nav>
164
+
165
+ </div>
166
+ </nav>
167
+
168
+ <div id="documentation">
169
+ <h1 class="class">class Safubot::Twitter::Tweet</h1>
170
+
171
+ <div id="description" class="description">
172
+
173
+ <p><a href="Tweet.html">Tweet</a> is both a <a
174
+ href="../Request.html">Request</a> source and general-purpose tweet
175
+ storage. Mentions are automatically made into Requests, but not timeline
176
+ tweets.</p>
177
+
178
+ </div><!-- description -->
179
+
180
+
181
+
182
+
183
+ <section id="5Buntitled-5D" class="documentation-section">
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <!-- Methods -->
193
+
194
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
195
+ <h3 class="section-header">Public Class Methods</h3>
196
+
197
+
198
+ <div id="method-c-5B-5D" class="method-detail ">
199
+
200
+ <div class="method-heading">
201
+ <span class="method-name">[]</span><span
202
+ class="method-args">(id)</span>
203
+ <span class="method-click-advice">click to toggle source</span>
204
+ </div>
205
+
206
+
207
+ <div class="method-description">
208
+
209
+ <p>Quickly look up a <a href="Tweet.html">Tweet</a>. @param id The <a
210
+ href="../Twitter.html">Twitter</a> id.</p>
211
+
212
+
213
+
214
+ <div class="method-source-code" id="5B-5D-source">
215
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 59</span>
216
+ <span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">id</span>)
217
+ <span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'raw.id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">id</span>).<span class="ruby-identifier">first</span>
218
+ <span class="ruby-keyword">end</span></pre>
219
+ </div><!-- 5B-5D-source -->
220
+
221
+ </div>
222
+
223
+
224
+
225
+
226
+ </div><!-- 5B-5D-method -->
227
+
228
+
229
+ <div id="method-c-from" class="method-detail ">
230
+
231
+ <div class="method-heading">
232
+ <span class="method-name">from</span><span
233
+ class="method-args">(status)</span>
234
+ <span class="method-click-advice">click to toggle source</span>
235
+ </div>
236
+
237
+
238
+ <div class="method-description">
239
+
240
+ <p>Find or create a <a href="Tweet.html">Tweet</a>. @param status An
241
+ appropriate ::Twitter or ::TweetStream object.</p>
242
+
243
+
244
+
245
+ <div class="method-source-code" id="from-source">
246
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 65</span>
247
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">from</span>(<span class="ruby-identifier">status</span>)
248
+ <span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'raw.id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">status</span>[<span class="ruby-string">'id'</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">status</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span>
249
+ <span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">create</span>(<span class="ruby-value">:raw</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">status</span>[<span class="ruby-string">'attrs'</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">status</span>)
250
+ <span class="ruby-keyword">end</span></pre>
251
+ </div><!-- from-source -->
252
+
253
+ </div>
254
+
255
+
256
+
257
+
258
+ </div><!-- from-method -->
259
+
260
+
261
+ </section><!-- public-class-method-details -->
262
+
263
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
264
+ <h3 class="section-header">Public Instance Methods</h3>
265
+
266
+
267
+ <div id="method-i-header_mentions" class="method-detail ">
268
+
269
+ <div class="method-heading">
270
+ <span class="method-name">header_mentions</span><span
271
+ class="method-args">()</span>
272
+ <span class="method-click-advice">click to toggle source</span>
273
+ </div>
274
+
275
+
276
+ <div class="method-description">
277
+
278
+ <p>Retrieve a substring containing the leading mentions.</p>
279
+
280
+
281
+
282
+ <div class="method-source-code" id="header_mentions-source">
283
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 82</span>
284
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">header_mentions</span>
285
+ <span class="ruby-identifier">m</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(@\w+ )+/</span>)
286
+ <span class="ruby-identifier">m</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> [] <span class="ruby-operator">:</span> <span class="ruby-identifier">m</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">split</span>
287
+ <span class="ruby-keyword">end</span></pre>
288
+ </div><!-- header_mentions-source -->
289
+
290
+ </div>
291
+
292
+
293
+
294
+
295
+ </div><!-- header_mentions-method -->
296
+
297
+
298
+ <div id="method-i-make_request" class="method-detail ">
299
+
300
+ <div class="method-heading">
301
+ <span class="method-name">make_request</span><span
302
+ class="method-args">()</span>
303
+ <span class="method-click-advice">click to toggle source</span>
304
+ </div>
305
+
306
+
307
+ <div class="method-description">
308
+
309
+ <p>Finds or creates a <a href="../Request.html">Request</a> sourced from this
310
+ <a href="Tweet.html">Tweet</a>.</p>
311
+
312
+
313
+
314
+ <div class="method-source-code" id="make_request-source">
315
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 108</span>
316
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">make_request</span>
317
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">request</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Request</span>.<span class="ruby-identifier">create</span>(<span class="ruby-value">:user</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">user</span>, <span class="ruby-value">:source</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>, <span class="ruby-value">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">targetless_text</span>)
318
+ <span class="ruby-keyword">end</span></pre>
319
+ </div><!-- make_request-source -->
320
+
321
+ </div>
322
+
323
+
324
+
325
+
326
+ </div><!-- make_request-method -->
327
+
328
+
329
+ <div id="method-i-original_tweet" class="method-detail ">
330
+
331
+ <div class="method-heading">
332
+ <span class="method-name">original_tweet</span><span
333
+ class="method-args">()</span>
334
+ <span class="method-click-advice">click to toggle source</span>
335
+ </div>
336
+
337
+
338
+ <div class="method-description">
339
+
340
+ <p>Returns the original tweet of which this is a RT if available.</p>
341
+
342
+
343
+
344
+ <div class="method-source-code" id="original_tweet-source">
345
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 88</span>
346
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">original_tweet</span>
347
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'retweeted_status'</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">from</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'retweeted_status'</span>])
348
+ <span class="ruby-keyword">end</span></pre>
349
+ </div><!-- original_tweet-source -->
350
+
351
+ </div>
352
+
353
+
354
+
355
+
356
+ </div><!-- original_tweet-method -->
357
+
358
+
359
+ <div id="method-i-posted_at" class="method-detail ">
360
+
361
+ <div class="method-heading">
362
+ <span class="method-name">posted_at</span><span
363
+ class="method-args">()</span>
364
+ <span class="method-click-advice">click to toggle source</span>
365
+ </div>
366
+
367
+
368
+ <div class="method-description">
369
+
370
+ <p>Returns a Time object specifying the time of publication.</p>
371
+
372
+
373
+
374
+ <div class="method-source-code" id="posted_at-source">
375
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 103</span>
376
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">posted_at</span>
377
+ <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'created_at'</span>])
378
+ <span class="ruby-keyword">end</span></pre>
379
+ </div><!-- posted_at-source -->
380
+
381
+ </div>
382
+
383
+
384
+
385
+
386
+ </div><!-- posted_at-method -->
387
+
388
+
389
+ <div id="method-i-targetless_text" class="method-detail ">
390
+
391
+ <div class="method-heading">
392
+ <span class="method-name">targetless_text</span><span
393
+ class="method-args">()</span>
394
+ <span class="method-click-advice">click to toggle source</span>
395
+ </div>
396
+
397
+
398
+ <div class="method-description">
399
+
400
+ <p>Plain text without the leading mentions.</p>
401
+
402
+
403
+
404
+ <div class="method-source-code" id="targetless_text-source">
405
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 77</span>
406
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">targetless_text</span>
407
+ <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/^(@\w+ )+/</span>, <span class="ruby-string">''</span>)
408
+ <span class="ruby-keyword">end</span></pre>
409
+ </div><!-- targetless_text-source -->
410
+
411
+ </div>
412
+
413
+
414
+
415
+
416
+ </div><!-- targetless_text-method -->
417
+
418
+
419
+ <div id="method-i-text" class="method-detail ">
420
+
421
+ <div class="method-heading">
422
+ <span class="method-name">text</span><span
423
+ class="method-args">()</span>
424
+ <span class="method-click-advice">click to toggle source</span>
425
+ </div>
426
+
427
+
428
+ <div class="method-description">
429
+
430
+ <p>The plain text.</p>
431
+
432
+
433
+
434
+ <div class="method-source-code" id="text-source">
435
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 72</span>
436
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">text</span>
437
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'text'</span>]
438
+ <span class="ruby-keyword">end</span></pre>
439
+ </div><!-- text-source -->
440
+
441
+ </div>
442
+
443
+
444
+
445
+
446
+ </div><!-- text-method -->
447
+
448
+
449
+ <div id="method-i-user" class="method-detail ">
450
+
451
+ <div class="method-heading">
452
+ <span class="method-name">user</span><span
453
+ class="method-args">()</span>
454
+ <span class="method-click-advice">click to toggle source</span>
455
+ </div>
456
+
457
+
458
+ <div class="method-description">
459
+
460
+ <p>Finds or creates a <a href="../KnownUser.html">KnownUser</a> connected to
461
+ this <a href="Tweet.html">Tweet</a>.</p>
462
+
463
+
464
+
465
+ <div class="method-source-code" id="user-source">
466
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 93</span>
467
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">user</span>
468
+ <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">by_twitter</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw</span>[<span class="ruby-string">'user'</span>][<span class="ruby-string">'id'</span>])
469
+ <span class="ruby-keyword">end</span></pre>
470
+ </div><!-- user-source -->
471
+
472
+ </div>
473
+
474
+
475
+
476
+
477
+ </div><!-- user-method -->
478
+
479
+
480
+ <div id="method-i-username" class="method-detail ">
481
+
482
+ <div class="method-heading">
483
+ <span class="method-name">username</span><span
484
+ class="method-args">()</span>
485
+ <span class="method-click-advice">click to toggle source</span>
486
+ </div>
487
+
488
+
489
+ <div class="method-description">
490
+
491
+ <p>Finds the user’s screen_name.</p>
492
+
493
+
494
+
495
+ <div class="method-source-code" id="username-source">
496
+ <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 98</span>
497
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">username</span>
498
+ <span class="ruby-identifier">user</span>.<span class="ruby-identifier">twitter</span>[<span class="ruby-string">'screen_name'</span>]
499
+ <span class="ruby-keyword">end</span></pre>
500
+ </div><!-- username-source -->
501
+
502
+ </div>
503
+
504
+
505
+
506
+
507
+ </div><!-- username-method -->
508
+
509
+
510
+ </section><!-- public-instance-method-details -->
511
+
512
+ </section><!-- 5Buntitled-5D -->
513
+
514
+ </div><!-- documentation -->
515
+
516
+
517
+ <footer id="validator-badges">
518
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
519
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
520
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
521
+ </footer>
522
+