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,344 +1,566 @@
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::KnownUser
8
+
9
+ &mdash; Documentation by YARD 0.7.3
10
+
11
+ </title>
6
12
 
7
- <title>Class: Safubot::KnownUser</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>
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
44
23
 
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
45
25
 
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/xmpp.rb
51
- <li>lib/safubot/known_user.rb
52
- <li>lib/safubot/twitter.rb
53
- </ul>
54
- </nav>
55
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>
56
32
 
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
33
+ <div id="header">
34
+ <div id="menu">
63
35
 
64
- <p class="link"><a href="../Object.html">Object</a>
36
+ <a href="../_index.html">Index (K)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Safubot.html" title="Safubot (module)">Safubot</a></span></span>
38
+ &raquo;
39
+ <span class="title">KnownUser</span>
65
40
 
66
- </nav>
67
-
68
- <!-- Included Modules -->
69
- <nav id="includes-section" class="section">
70
- <h3 class="section-header">Included Modules</h3>
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
71
44
 
72
- <ul class="link-list">
45
+ <div id="search">
73
46
 
47
+ <a id="class_list_link" href="#">Class List</a>
74
48
 
75
- <li><span class="include">MongoMapper::Document</span>
49
+ <a id="method_list_link" href="#">Method List</a>
76
50
 
51
+ <a id="file_list_link" href="#">File List</a>
77
52
 
78
- </ul>
79
- </nav>
80
-
81
- <!-- Method Quickref -->
82
- <nav id="method-list-section" class="section">
83
- <h3 class="section-header">Methods</h3>
84
-
85
- <ul class="link-list">
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
86
58
 
87
- <li><a href="#method-c-by_twitter">::by_twitter</a>
59
+ <div id="content"><h1>Class: Safubot::KnownUser
60
+
61
+
62
+
63
+ </h1>
64
+
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::KnownUser</li>
75
+
76
+ </ul>
77
+ <a href="#" class="inheritanceTree">show all</a>
78
+
79
+ </dd>
88
80
 
89
- <li><a href="#method-c-by_xmpp">::by_xmpp</a>
81
+
82
+
90
83
 
91
- <li><a href="#method-i-merge">#merge</a>
84
+
92
85
 
93
- <li><a href="#method-i-tweets">#tweets</a>
86
+ <dt class="r2">Includes:</dt>
87
+ <dd class="r2">MongoMapper::Document</dd>
88
+
94
89
 
95
- </ul>
96
- </nav>
90
+
91
+
92
+
93
+ <dt class="r1 last">Defined in:</dt>
94
+ <dd class="r1 last">lib/safubot/known_user.rb<span class="defines">,<br />
95
+ lib/safubot/xmpp.rb,<br /> lib/safubot/twitter.rb,<br /> lib/safubot/test_helper.rb</span>
96
+ </dd>
97
+
98
+ </dl>
99
+ <div class="clear"></div>
97
100
 
98
- </div>
101
+ <h2>Overview</h2><div class="docstring">
102
+ <div class="discussion">
103
+ <p>
104
+ General identity cache. Extended by service-specific modules. A single
105
+ class in order to allow linking of identity between services.
106
+ </p>
99
107
 
100
- <div id="project-metadata">
101
- <nav id="fileindex-section" class="section project-section">
102
- <h3 class="section-header">Pages</h3>
103
108
 
104
- <ul>
105
-
106
- <li class="file"><a href="../Gemfile.html">Gemfile</a>
109
+ </div>
110
+ </div>
111
+ <div class="tags">
107
112
 
108
- <li class="file"><a href="../Rakefile.html">Rakefile</a>
113
+
114
+ </div>
115
+
109
116
 
110
- </ul>
111
- </nav>
112
117
 
113
- <nav id="classindex-section" class="section project-section">
114
- <h3 class="section-header">Class and Module Index</h3>
115
118
 
116
- <ul class="link-list">
117
119
 
118
- <li><a href="../Safubot.html">Safubot</a>
120
+
119
121
 
120
- <li><a href="../Safubot/Bot.html">Safubot::Bot</a>
122
+ <h2>
123
+ Class Method Summary
124
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
125
+ </h2>
126
+
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#by_name-class_method" title="by_name (class method)">+ (Object) <strong>by_name</strong>(name) </a>
133
+
134
+
135
+
136
+ </span>
121
137
 
122
- <li><a href="../Safubot/Evented.html">Safubot::Evented</a>
123
138
 
124
- <li><a href="../Safubot/KnownUser.html">Safubot::KnownUser</a>
125
139
 
126
- <li><a href="../Safubot/Log.html">Safubot::Log</a>
127
140
 
128
- <li><a href="../Safubot/Query.html">Safubot::Query</a>
129
141
 
130
- <li><a href="../Safubot/Request.html">Safubot::Request</a>
131
142
 
132
- <li><a href="../Safubot/Response.html">Safubot::Response</a>
143
+
133
144
 
134
- <li><a href="../Safubot/Test.html">Safubot::Test</a>
145
+ <span class="summary_desc"><div class='inline'><p>
146
+ Retrieves user by internal identifier.
147
+ </p>
148
+ </div></span>
135
149
 
136
- <li><a href="../Safubot/Twitter.html">Safubot::Twitter</a>
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#by_twitter-class_method" title="by_twitter (class method)">+ (Object) <strong>by_twitter</strong>(name_or_id) </a>
157
+
158
+
159
+
160
+ </span>
137
161
 
138
- <li><a href="../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
139
162
 
140
- <li><a href="../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
141
163
 
142
- <li><a href="../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
143
164
 
144
- <li><a href="../Safubot/XMPP.html">Safubot::XMPP</a>
145
165
 
146
- <li><a href="../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
147
166
 
148
- <li><a href="../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
167
+
149
168
 
150
- <li><a href="../Object.html">Object</a>
169
+ <span class="summary_desc"><div class='inline'><p>
170
+ Retrieve or construct a KnownUser by the given Twitter screen name.
171
+ </p>
172
+ </div></span>
151
173
 
152
- </ul>
153
- </nav>
174
+ </li>
154
175
 
155
- </div>
156
- </nav>
157
-
158
- <div id="documentation">
159
- <h1 class="class">class Safubot::KnownUser</h1>
160
-
161
- <div id="description" class="description">
176
+
177
+ <li class="public ">
178
+ <span class="summary_signature">
179
+
180
+ <a href="#by_xmpp-class_method" title="by_xmpp (class method)">+ (Object) <strong>by_xmpp</strong>(jid) </a>
162
181
 
163
- <p>General identity cache. Extended by service-specific modules. A single
164
- class to allow for linking of identity between services.</p>
165
182
 
166
- </div><!-- description -->
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+
190
+
167
191
 
168
192
 
193
+ <span class="summary_desc"><div class='inline'><p>
194
+ Retrieves or creates a KnownUser by an XMPP JID string.
195
+ </p>
196
+ </div></span>
169
197
 
198
+ </li>
199
+
200
+
201
+ </ul>
170
202
 
171
- <section id="5Buntitled-5D" class="documentation-section">
172
-
203
+ <h2>
204
+ Instance Method Summary
205
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
206
+ </h2>
173
207
 
208
+ <ul class="summary">
209
+
210
+ <li class="public ">
211
+ <span class="summary_signature">
174
212
 
175
-
213
+ <a href="#merge-instance_method" title="#merge (instance method)">- (Object) <strong>merge</strong>(user) </a>
176
214
 
177
215
 
178
216
 
217
+ </span>
218
+
219
+
220
+
221
+
222
+
223
+
179
224
 
180
- <!-- Methods -->
225
+
226
+ <span class="summary_desc"><div class='inline'><p>
227
+ Combines the service-specific identities of two users to form a cohesive
228
+ picture of an individual.
229
+ </p>
230
+ </div></span>
231
+
232
+ </li>
233
+
234
+
235
+ <li class="public ">
236
+ <span class="summary_signature">
237
+
238
+ <a href="#tweets-instance_method" title="#tweets (instance method)">- (Object) <strong>tweets</strong> </a>
181
239
 
182
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
183
- <h3 class="section-header">Public Class Methods</h3>
184
240
 
185
241
 
186
- <div id="method-c-by_twitter" class="method-detail ">
187
-
188
- <div class="method-heading">
189
- <span class="method-name">by_twitter</span><span
190
- class="method-args">(name_or_id)</span>
191
- <span class="method-click-advice">click to toggle source</span>
192
- </div>
193
-
242
+ </span>
243
+
244
+
245
+
246
+
247
+
248
+
194
249
 
195
- <div class="method-description">
196
-
197
- <p>Retrieve or construct a <a href="KnownUser.html">KnownUser</a> by the given
198
- <a href="Twitter.html">Twitter</a> screen name. @param name_or_id The <a
199
- href="Twitter.html">Twitter</a> screen_name (String) or id (Integer).</p>
200
-
250
+
251
+ <span class="summary_desc"><div class='inline'><p>
252
+ Plucky query with Tweets scoped to this user&#8217;s twitter id.
253
+ </p>
254
+ </div></span>
255
+
256
+ </li>
201
257
 
202
-
203
- <div class="method-source-code" id="by_twitter-source">
204
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 11</span>
205
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">by_twitter</span>(<span class="ruby-identifier">name_or_id</span>)
206
- <span class="ruby-identifier">user</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">name_or_id</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
207
- <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'twitter.screen_name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name_or_id</span>).<span class="ruby-identifier">first</span>
208
- <span class="ruby-keyword">else</span>
209
- <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'twitter.id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name_or_id</span>).<span class="ruby-identifier">first</span>
210
- <span class="ruby-keyword">end</span>
211
-
212
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">nil?</span>
213
- <span class="ruby-identifier">details</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Twitter</span>.<span class="ruby-identifier">user</span>(<span class="ruby-identifier">name_or_id</span>)
214
- <span class="ruby-comment"># This second lookup is necessary as the screen_name that comes back from</span>
215
- <span class="ruby-comment"># Twitter.user might not be the same as the one we were originally provided</span>
216
- <span class="ruby-comment"># with.</span>
217
- <span class="ruby-identifier">user</span> = <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'twitter.screen_name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>.<span class="ruby-identifier">screen_name</span>).<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span>
218
- <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">create</span>(<span class="ruby-value">:twitter</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>.<span class="ruby-identifier">attrs</span>, <span class="ruby-value">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">details</span>.<span class="ruby-identifier">screen_name</span>)
219
- <span class="ruby-keyword">end</span>
220
-
221
- <span class="ruby-identifier">user</span>
222
- <span class="ruby-keyword">end</span></pre>
223
- </div><!-- by_twitter-source -->
224
-
225
- </div>
258
+
259
+ </ul>
260
+
226
261
 
227
-
228
262
 
229
-
230
- </div><!-- by_twitter-method -->
263
+
231
264
 
265
+ <div id="class_method_details" class="method_details_list">
266
+ <h2>Class Method Details</h2>
232
267
 
233
- <div id="method-c-by_xmpp" class="method-detail ">
234
-
235
- <div class="method-heading">
236
- <span class="method-name">by_xmpp</span><span
237
- class="method-args">(jid)</span>
238
- <span class="method-click-advice">click to toggle source</span>
239
- </div>
240
-
241
-
242
- <div class="method-description">
243
-
244
- <p>Retrieves or creates a <a href="KnownUser.html">KnownUser</a> by an <a
245
- href="XMPP.html">XMPP</a> JID string.</p>
246
-
247
-
248
-
249
- <div class="method-source-code" id="by_xmpp-source">
250
- <pre><span class="ruby-comment"># File lib/safubot/xmpp.rb, line 11</span>
251
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">by_xmpp</span>(<span class="ruby-identifier">jid</span>)
252
- <span class="ruby-identifier">jid</span> = <span class="ruby-identifier">jid</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'/'</span>)[<span class="ruby-value">0</span>]
253
- <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'jid'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">jid</span>).<span class="ruby-identifier">first</span> <span class="ruby-operator">||</span>
254
- <span class="ruby-constant">KnownUser</span>.<span class="ruby-identifier">create</span>(<span class="ruby-value">:jid</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">jid</span>, <span class="ruby-value">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">jid</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'@'</span>)[<span class="ruby-value">0</span>])
255
- <span class="ruby-keyword">end</span></pre>
256
- </div><!-- by_xmpp-source -->
257
-
258
- </div>
268
+
269
+ <div class="method_details first">
270
+ <p class="signature first" id="by_name-class_method">
271
+
272
+ + (<tt>Object</tt>) <strong>by_name</strong>(name)
273
+
259
274
 
260
-
275
+
276
+ </p><div class="docstring">
277
+ <div class="discussion">
278
+ <p>
279
+ Retrieves user by internal identifier.
280
+ </p>
261
281
 
262
-
263
- </div><!-- by_xmpp-method -->
264
282
 
283
+ </div>
284
+ </div>
285
+ <div class="tags">
286
+
287
+
288
+ </div><table class="source_code">
289
+ <tr>
290
+ <td>
291
+ <pre class="lines">
292
+
293
+
294
+ 11
295
+ 12
296
+ 13
297
+ 14</pre>
298
+ </td>
299
+ <td>
300
+ <pre class="code"><span class="info file"># File 'lib/safubot/test_helper.rb', line 11</span>
301
+
302
+ <span class='kw'>def</span> <span class='id by_name'>by_name</span><span class='lparen'>(</span><span class='id name'>name</span><span class='rparen'>)</span>
303
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id where'>where</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='id name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span> <span class='op'>||</span>
304
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id create'>create</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='id name'>name</span><span class='rparen'>)</span>
305
+ <span class='kw'>end</span></pre>
306
+ </td>
307
+ </tr>
308
+ </table>
309
+ </div>
265
310
 
266
- </section><!-- public-class-method-details -->
311
+ <div class="method_details ">
312
+ <p class="signature " id="by_twitter-class_method">
313
+
314
+ + (<tt>Object</tt>) <strong>by_twitter</strong>(name_or_id)
267
315
 
268
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
269
- <h3 class="section-header">Public Instance Methods</h3>
270
316
 
271
-
272
- <div id="method-i-merge" class="method-detail ">
273
-
274
- <div class="method-heading">
275
- <span class="method-name">merge</span><span
276
- class="method-args">(user)</span>
277
- <span class="method-click-advice">click to toggle source</span>
278
- </div>
279
-
317
+
318
+ </p><div class="docstring">
319
+ <div class="discussion">
320
+ <p>
321
+ Retrieve or construct a KnownUser by the given Twitter screen name.
322
+ </p>
280
323
 
281
- <div class="method-description">
282
-
283
- <p>Combines the service-specific identities of two users to form a cohesive
284
- picture of an individual.</p>
285
-
286
324
 
287
-
288
- <div class="method-source-code" id="merge-source">
289
- <pre><span class="ruby-comment"># File lib/safubot/known_user.rb, line 10</span>
290
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">user</span>)
291
- <span class="ruby-keyword">end</span></pre>
292
- </div><!-- merge-source -->
293
-
294
- </div>
325
+ </div>
326
+ </div>
327
+ <div class="tags">
328
+ <h3>Parameters:</h3>
329
+ <ul class="param">
330
+
331
+ <li>
332
+
333
+ <span class='name'>name_or_id</span>
334
+
335
+
336
+ <span class='type'></span>
337
+
338
+
339
+
340
+ &mdash;
341
+ <div class='inline'><p>
342
+ The Twitter screen_name (String) or id (Integer).
343
+ </p>
344
+ </div>
345
+
346
+ </li>
347
+
348
+ </ul>
349
+
350
+
351
+ </div><table class="source_code">
352
+ <tr>
353
+ <td>
354
+ <pre class="lines">
355
+
356
+
357
+ 11
358
+ 12
359
+ 13
360
+ 14
361
+ 15
362
+ 16
363
+ 17
364
+ 18
365
+ 19
366
+ 20
367
+ 21
368
+ 22
369
+ 23
370
+ 24
371
+ 25
372
+ 26
373
+ 27
374
+ 28</pre>
375
+ </td>
376
+ <td>
377
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 11</span>
378
+
379
+ <span class='kw'>def</span> <span class='id by_twitter'>by_twitter</span><span class='lparen'>(</span><span class='id name_or_id'>name_or_id</span><span class='rparen'>)</span>
380
+ <span class='id user'>user</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id name_or_id'>name_or_id</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>String</span>
381
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id where'>where</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>twitter.screen_name</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id name_or_id'>name_or_id</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span>
382
+ <span class='kw'>else</span>
383
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id where'>where</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>twitter.id</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id name_or_id'>name_or_id</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span>
384
+ <span class='kw'>end</span>
385
+
386
+ <span class='kw'>if</span> <span class='id user'>user</span><span class='period'>.</span><span class='id nil?'>nil?</span>
387
+ <span class='id details'>details</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Twitter</span><span class='period'>.</span><span class='id user'>user</span><span class='lparen'>(</span><span class='id name_or_id'>name_or_id</span><span class='rparen'>)</span>
388
+ <span class='comment'># This second lookup is necessary as the screen_name that comes back from
389
+ </span> <span class='comment'># Twitter.user might not be the same as the one we were originally provided
390
+ </span> <span class='comment'># with.
391
+ </span> <span class='id user'>user</span> <span class='op'>=</span> <span class='const'>KnownUser</span><span class='period'>.</span><span class='id where'>where</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>twitter.screen_name</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id details'>details</span><span class='period'>.</span><span class='id screen_name'>screen_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span> <span class='op'>||</span>
392
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id create'>create</span><span class='lparen'>(</span><span class='symbol'>:twitter</span> <span class='op'>=&gt;</span> <span class='id details'>details</span><span class='period'>.</span><span class='id attrs'>attrs</span><span class='comma'>,</span> <span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='id details'>details</span><span class='period'>.</span><span class='id screen_name'>screen_name</span><span class='rparen'>)</span>
393
+ <span class='kw'>end</span>
394
+
395
+ <span class='id user'>user</span>
396
+ <span class='kw'>end</span></pre>
397
+ </td>
398
+ </tr>
399
+ </table>
400
+ </div>
401
+
402
+ <div class="method_details ">
403
+ <p class="signature " id="by_xmpp-class_method">
404
+
405
+ + (<tt>Object</tt>) <strong>by_xmpp</strong>(jid)
406
+
295
407
 
296
-
408
+
409
+ </p><div class="docstring">
410
+ <div class="discussion">
411
+ <p>
412
+ Retrieves or creates a KnownUser by an XMPP JID string.
413
+ </p>
297
414
 
298
-
299
- </div><!-- merge-method -->
300
415
 
416
+ </div>
417
+ </div>
418
+ <div class="tags">
419
+
420
+
421
+ </div><table class="source_code">
422
+ <tr>
423
+ <td>
424
+ <pre class="lines">
425
+
426
+
427
+ 11
428
+ 12
429
+ 13
430
+ 14
431
+ 15</pre>
432
+ </td>
433
+ <td>
434
+ <pre class="code"><span class="info file"># File 'lib/safubot/xmpp.rb', line 11</span>
435
+
436
+ <span class='kw'>def</span> <span class='id by_xmpp'>by_xmpp</span><span class='lparen'>(</span><span class='id jid'>jid</span><span class='rparen'>)</span>
437
+ <span class='id jid'>jid</span> <span class='op'>=</span> <span class='id jid'>jid</span><span class='period'>.</span><span class='id split'>split</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='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
438
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id where'>where</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>jid</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='id jid'>jid</span><span class='rparen'>)</span><span class='period'>.</span><span class='id first'>first</span> <span class='op'>||</span>
439
+ <span class='const'>KnownUser</span><span class='period'>.</span><span class='id create'>create</span><span class='lparen'>(</span><span class='symbol'>:jid</span> <span class='op'>=&gt;</span> <span class='id jid'>jid</span><span class='comma'>,</span> <span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='id jid'>jid</span><span class='period'>.</span><span class='id split'>split</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='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
440
+ <span class='kw'>end</span></pre>
441
+ </td>
442
+ </tr>
443
+ </table>
444
+ </div>
301
445
 
302
- <div id="method-i-tweets" class="method-detail ">
303
-
304
- <div class="method-heading">
305
- <span class="method-name">tweets</span><span
306
- class="method-args">()</span>
307
- <span class="method-click-advice">click to toggle source</span>
308
- </div>
309
-
310
-
311
- <div class="method-description">
312
-
313
- <p>Plucky query with Tweets scoped to this user’s twitter id.</p>
314
-
446
+ </div>
315
447
 
316
-
317
- <div class="method-source-code" id="tweets-source">
318
- <pre><span class="ruby-comment"># File lib/safubot/twitter.rb, line 32</span>
319
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">tweets</span>
320
- <span class="ruby-constant">Twitter</span><span class="ruby-operator">::</span><span class="ruby-constant">Tweet</span>.<span class="ruby-identifier">where</span>(<span class="ruby-string">'raw.user.id'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">twitter</span>[<span class="ruby-string">'id'</span>])
321
- <span class="ruby-keyword">end</span></pre>
322
- </div><!-- tweets-source -->
323
-
324
- </div>
448
+ <div id="instance_method_details" class="method_details_list">
449
+ <h2>Instance Method Details</h2>
450
+
451
+
452
+ <div class="method_details first">
453
+ <p class="signature first" id="merge-instance_method">
454
+
455
+ - (<tt>Object</tt>) <strong>merge</strong>(user)
456
+
325
457
 
326
-
458
+
459
+ </p><div class="docstring">
460
+ <div class="discussion">
461
+ <p>
462
+ Combines the service-specific identities of two users to form a cohesive
463
+ picture of an individual.
464
+ </p>
327
465
 
328
-
329
- </div><!-- tweets-method -->
330
466
 
467
+ </div>
468
+ </div>
469
+ <div class="tags">
470
+
471
+
472
+ </div><table class="source_code">
473
+ <tr>
474
+ <td>
475
+ <pre class="lines">
476
+
477
+
478
+ 12
479
+ 13
480
+ 14
481
+ 15
482
+ 16
483
+ 17
484
+ 18
485
+ 19
486
+ 20
487
+ 21
488
+ 22
489
+ 23
490
+ 24
491
+ 25</pre>
492
+ </td>
493
+ <td>
494
+ <pre class="code"><span class="info file"># File 'lib/safubot/known_user.rb', line 12</span>
495
+
496
+ <span class='kw'>def</span> <span class='id merge'>merge</span><span class='lparen'>(</span><span class='id user'>user</span><span class='rparen'>)</span>
497
+ <span class='kw'>self</span><span class='period'>.</span><span class='id keys'>keys</span><span class='period'>.</span><span class='id keys'>keys</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id key'>key</span><span class='op'>|</span>
498
+ <span class='const'>Log</span><span class='period'>.</span><span class='id info'>info</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id key'>key</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id user'>user</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
499
+ <span class='kw'>self</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id user'>user</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:empty?</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id empty?'>empty?</span><span class='rparen'>)</span>
500
+ <span class='kw'>end</span>
501
+
502
+ <span class='id user'>user</span><span class='period'>.</span><span class='id requests'>requests</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id req'>req</span><span class='op'>|</span>
503
+ <span class='id req'>req</span><span class='period'>.</span><span class='id user'>user</span> <span class='op'>=</span> <span class='kw'>self</span><span class='semicolon'>;</span> <span class='id req'>req</span><span class='period'>.</span><span class='id save!'>save!</span>
504
+ <span class='kw'>end</span>
505
+
506
+ <span class='id save!'>save!</span>
507
+
508
+ <span class='id user'>user</span><span class='period'>.</span><span class='id destroy'>destroy</span>
509
+ <span class='kw'>end</span></pre>
510
+ </td>
511
+ </tr>
512
+ </table>
513
+ </div>
331
514
 
332
- </section><!-- public-instance-method-details -->
515
+ <div class="method_details ">
516
+ <p class="signature " id="tweets-instance_method">
517
+
518
+ - (<tt>Object</tt>) <strong>tweets</strong>
333
519
 
334
- </section><!-- 5Buntitled-5D -->
335
520
 
336
- </div><!-- documentation -->
521
+
522
+ </p><div class="docstring">
523
+ <div class="discussion">
524
+ <p>
525
+ Plucky query with Tweets scoped to this user&#8217;s twitter id.
526
+ </p>
337
527
 
338
528
 
339
- <footer id="validator-badges">
340
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
341
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
342
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
343
- </footer>
529
+ </div>
530
+ </div>
531
+ <div class="tags">
532
+
533
+
534
+ </div><table class="source_code">
535
+ <tr>
536
+ <td>
537
+ <pre class="lines">
538
+
539
+
540
+ 32
541
+ 33
542
+ 34</pre>
543
+ </td>
544
+ <td>
545
+ <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 32</span>
546
+
547
+ <span class='kw'>def</span> <span class='id tweets'>tweets</span>
548
+ <span class='const'>Twitter</span><span class='op'>::</span><span class='const'>Tweet</span><span class='period'>.</span><span class='id where'>where</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>raw.user.id</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id twitter'>twitter</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>
549
+ <span class='kw'>end</span></pre>
550
+ </td>
551
+ </tr>
552
+ </table>
553
+ </div>
554
+
555
+ </div>
344
556
 
557
+ </div>
558
+
559
+ <div id="footer">
560
+ Generated on Mon Nov 28 20:20:03 2011 by
561
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
562
+ 0.7.3 (ruby-1.9.2).
563
+ </div>
564
+
565
+ </body>
566
+ </html>