kermit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/Gemfile +18 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +54 -0
  4. data/Rakefile +31 -0
  5. data/VERSION +1 -0
  6. data/bin/kermit +24 -0
  7. data/config/config.example.yml +24 -0
  8. data/doc/Adapter.html +533 -0
  9. data/doc/Converter.html +348 -0
  10. data/doc/DAO.html +1047 -0
  11. data/doc/KermitPFC.html +927 -0
  12. data/doc/Link.html +667 -0
  13. data/doc/Logging.html +401 -0
  14. data/doc/Logging/Settings.html +170 -0
  15. data/doc/RandomAdapter.html +501 -0
  16. data/doc/RandomConverter.html +359 -0
  17. data/doc/RandomPhraseGenerator.html +317 -0
  18. data/doc/ToUser.html +815 -0
  19. data/doc/TwitterAdapter.html +550 -0
  20. data/doc/TwitterConverter.html +598 -0
  21. data/doc/USMF.html +2188 -0
  22. data/doc/User.html +1407 -0
  23. data/doc/WebSocketClient.html +316 -0
  24. data/doc/WebSocketServer.html +427 -0
  25. data/doc/_index.html +270 -0
  26. data/doc/class_list.html +53 -0
  27. data/doc/css/common.css +1 -0
  28. data/doc/css/full_list.css +57 -0
  29. data/doc/css/style.css +328 -0
  30. data/doc/file.LICENSE.html +73 -0
  31. data/doc/file.README.html +123 -0
  32. data/doc/file_list.html +58 -0
  33. data/doc/frames.html +28 -0
  34. data/doc/index.html +123 -0
  35. data/doc/js/app.js +214 -0
  36. data/doc/js/full_list.js +173 -0
  37. data/doc/js/jquery.js +4 -0
  38. data/doc/method_list.html +764 -0
  39. data/doc/top-level-namespace.html +138 -0
  40. data/lib/business/adapter/adapter.rb +39 -0
  41. data/lib/business/adapter/random_adapter.rb +50 -0
  42. data/lib/business/adapter/twitter_adapter.rb +75 -0
  43. data/lib/business/converter/converter.rb +24 -0
  44. data/lib/business/converter/random_converter.rb +42 -0
  45. data/lib/business/converter/twitter_converter.rb +164 -0
  46. data/lib/business/random_phrase_generator.rb +39 -0
  47. data/lib/helper/DAO.rb +94 -0
  48. data/lib/helper/settings.rb +11 -0
  49. data/lib/helper/websocket_client.rb +37 -0
  50. data/lib/helper/websocket_server.rb +65 -0
  51. data/lib/kermitpfc.rb +164 -0
  52. data/lib/logging.rb +31 -0
  53. data/lib/model/USMF/USMF.rb +98 -0
  54. data/lib/model/USMF/link.rb +30 -0
  55. data/lib/model/USMF/to_user.rb +32 -0
  56. data/lib/model/USMF/user.rb +41 -0
  57. data/lib/model/templates/USMF +56 -0
  58. data/lib/model/templates/atom.xml +74 -0
  59. data/lib/model/templates/example +59 -0
  60. data/lib/model/templates/rss.xml +68 -0
  61. data/lib/model/templates/template +49 -0
  62. data/lib/model/templates/tweet +116 -0
  63. data/spec/DAO_spec.rb +64 -0
  64. data/spec/random_adapter_spec.rb +24 -0
  65. data/spec/random_converter_spec.rb +115 -0
  66. data/spec/random_phrase_generator_spec.rb +15 -0
  67. data/spec/twitter_adapter_spec.rb +24 -0
  68. data/spec/twitter_converter_spec.rb +132 -0
  69. data/websocket_client.html +20 -0
  70. metadata +253 -0
@@ -0,0 +1,348 @@
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: Converter
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (C)</a> &raquo;
35
+
36
+
37
+ <span class="title">Converter</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Converter
67
+ <span class="abstract note title">Abstract</span>
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Converter</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+ <dt class="r2">Includes:</dt>
94
+ <dd class="r2"><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></dd>
95
+
96
+
97
+
98
+
99
+
100
+ <dt class="r1 last">Defined in:</dt>
101
+ <dd class="r1 last">lib/business/converter/converter.rb</dd>
102
+
103
+ </dl>
104
+ <div class="clear"></div>
105
+
106
+ <h2>Overview</h2><div class="docstring">
107
+ <div class="discussion">
108
+ <div class="note abstract">
109
+ <strong>This class is abstract.</strong>
110
+ <div class='inline'></div>
111
+ </div>
112
+ <p>
113
+ Abstract class that must be implemented to transform a specifical status
114
+ from a Stream into a USMF standard message
115
+ </p>
116
+
117
+
118
+ </div>
119
+ </div>
120
+ <div class="tags">
121
+
122
+ <p class="tag_title">Author:</p>
123
+ <ul class="author">
124
+
125
+ <li>
126
+
127
+
128
+
129
+
130
+
131
+ <div class='inline'><p>
132
+ Daniel Machado Fernandez
133
+ </p>
134
+ </div>
135
+
136
+ </li>
137
+
138
+ </ul>
139
+ <p class="tag_title">Version:</p>
140
+ <ul class="version">
141
+
142
+ <li>
143
+
144
+
145
+
146
+
147
+
148
+ <div class='inline'><p>
149
+ 1.0
150
+ </p>
151
+ </div>
152
+
153
+ </li>
154
+
155
+ </ul>
156
+
157
+ </div><div id="subclasses">
158
+ <h2>Direct Known Subclasses</h2>
159
+ <p class="children"><span class='object_link'><a href="RandomConverter.html" title="RandomConverter (class)">RandomConverter</a></span>, <span class='object_link'><a href="TwitterConverter.html" title="TwitterConverter (class)">TwitterConverter</a></span></p>
160
+ </div>
161
+
162
+ <h2>Constant Summary</h2>
163
+
164
+
165
+
166
+
167
+ <h2>Constant Summary</h2>
168
+
169
+ <h3 class="inherited">Constants included
170
+ from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
171
+ <p class="inherited"><span class='object_link'><a href="Logging.html#KermitPFC-constant" title="Logging::KermitPFC (constant)">Logging::KermitPFC</a></span></p>
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <h2>
179
+ Instance Method Summary
180
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
181
+ </h2>
182
+
183
+ <ul class="summary">
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#to_usmf-instance_method" title="#to_usmf (instance method)">- (USMF) <strong>to_usmf</strong>(status) </a>
189
+
190
+
191
+
192
+ </span>
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'><p>
203
+ Parses a status into a USMF message.
204
+ </p>
205
+ </div></span>
206
+
207
+ </li>
208
+
209
+
210
+ </ul>
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
223
+ <p class="inherited"><span class='object_link'><a href="Logging.html#logger-instance_method" title="Logging#logger (method)">#logger</a></span>, <span class='object_link'><a href="Logging.html#logger-class_method" title="Logging.logger (method)">logger</a></span></p>
224
+
225
+
226
+ <div id="instance_method_details" class="method_details_list">
227
+ <h2>Instance Method Details</h2>
228
+
229
+
230
+ <div class="method_details first">
231
+ <h3 class="signature first" id="to_usmf-instance_method">
232
+
233
+ - (<tt><span class='object_link'><a href="USMF.html" title="USMF (class)">USMF</a></span></tt>) <strong>to_usmf</strong>(status)
234
+
235
+
236
+
237
+
238
+
239
+ </h3><div class="docstring">
240
+ <div class="discussion">
241
+ <p>
242
+ Parses a status into a USMF message
243
+ </p>
244
+
245
+
246
+ </div>
247
+ </div>
248
+ <div class="tags">
249
+ <p class="tag_title">Parameters:</p>
250
+ <ul class="param">
251
+
252
+ <li>
253
+
254
+ <span class='name'>status</span>
255
+
256
+
257
+ <span class='type'>(<tt>String</tt>)</span>
258
+
259
+
260
+
261
+ &mdash;
262
+ <div class='inline'><p>
263
+ status retrieved and saved previously in the Adapter
264
+ </p>
265
+ </div>
266
+
267
+ </li>
268
+
269
+ </ul>
270
+
271
+ <p class="tag_title">Returns:</p>
272
+ <ul class="return">
273
+
274
+ <li>
275
+
276
+
277
+ <span class='type'>(<tt><span class='object_link'><a href="USMF.html" title="USMF (class)">USMF</a></span></tt>)</span>
278
+
279
+
280
+
281
+ &mdash;
282
+ <div class='inline'><p>
283
+ the resultant USMF message
284
+ </p>
285
+ </div>
286
+
287
+ </li>
288
+
289
+ </ul>
290
+ <p class="tag_title">Raises:</p>
291
+ <ul class="raise">
292
+
293
+ <li>
294
+
295
+
296
+ <span class='type'>(<tt>Exception</tt>)</span>
297
+
298
+
299
+
300
+ &mdash;
301
+ <div class='inline'><p>
302
+ if the method hasn&#8217;t been implemented yet
303
+ </p>
304
+ </div>
305
+
306
+ </li>
307
+
308
+ </ul>
309
+
310
+ </div><table class="source_code">
311
+ <tr>
312
+ <td>
313
+ <pre class="lines">
314
+
315
+
316
+ 17
317
+ 18
318
+ 19
319
+ 20
320
+ 21
321
+ 22</pre>
322
+ </td>
323
+ <td>
324
+ <pre class="code"><span class="info file"># File 'lib/business/converter/converter.rb', line 17</span>
325
+
326
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_usmf'>to_usmf</span> <span class='id identifier rubyid_status'>status</span>
327
+
328
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>The method to_usmf in Converter must be implemented</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
329
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>This method must be implemented</span><span class='tstring_end'>'</span></span>
330
+
331
+ <span class='kw'>end</span></pre>
332
+ </td>
333
+ </tr>
334
+ </table>
335
+ </div>
336
+
337
+ </div>
338
+
339
+ </div>
340
+
341
+ <div id="footer">
342
+ Generated on Sat Aug 18 16:24:08 2012 by
343
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
344
+ 0.8.2.1 (ruby-1.9.2).
345
+ </div>
346
+
347
+ </body>
348
+ </html>
@@ -0,0 +1,1047 @@
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: DAO
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (D)</a> &raquo;
35
+
36
+
37
+ <span class="title">DAO</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: DAO
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">DAO</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+ <dt class="r2">Includes:</dt>
94
+ <dd class="r2"><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></dd>
95
+
96
+
97
+
98
+
99
+
100
+ <dt class="r1 last">Defined in:</dt>
101
+ <dd class="r1 last">lib/helper/DAO.rb</dd>
102
+
103
+ </dl>
104
+ <div class="clear"></div>
105
+
106
+ <h2>Overview</h2><div class="docstring">
107
+ <div class="discussion">
108
+ <p>
109
+ Data Access Object to manage the persistence layer of the app
110
+ </p>
111
+
112
+
113
+ </div>
114
+ </div>
115
+ <div class="tags">
116
+
117
+ <p class="tag_title">Author:</p>
118
+ <ul class="author">
119
+
120
+ <li>
121
+
122
+
123
+
124
+
125
+
126
+ <div class='inline'><p>
127
+ Daniel Machado Fernandez
128
+ </p>
129
+ </div>
130
+
131
+ </li>
132
+
133
+ </ul>
134
+ <p class="tag_title">Version:</p>
135
+ <ul class="version">
136
+
137
+ <li>
138
+
139
+
140
+
141
+
142
+
143
+ <div class='inline'><p>
144
+ 1.0
145
+ </p>
146
+ </div>
147
+
148
+ </li>
149
+
150
+ </ul>
151
+
152
+ </div>
153
+ <h2>Constant Summary</h2>
154
+
155
+
156
+
157
+
158
+ <h2>Constant Summary</h2>
159
+
160
+ <h3 class="inherited">Constants included
161
+ from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
162
+ <p class="inherited"><span class='object_link'><a href="Logging.html#KermitPFC-constant" title="Logging::KermitPFC (constant)">Logging::KermitPFC</a></span></p>
163
+
164
+
165
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
166
+ <ul class="summary">
167
+
168
+ <li class="public ">
169
+ <span class="summary_signature">
170
+
171
+ <a href="#db-instance_method" title="#db (instance method)">- (Redis) <strong>db</strong> </a>
172
+
173
+
174
+
175
+ </span>
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+ <span class="summary_desc"><div class='inline'><p>
189
+ An instance from a Redis DB with the redis gem.
190
+ </p>
191
+ </div></span>
192
+
193
+ </li>
194
+
195
+
196
+ <li class="public ">
197
+ <span class="summary_signature">
198
+
199
+ <a href="#type-instance_method" title="#type (instance method)">- (String) <strong>type</strong> </a>
200
+
201
+
202
+
203
+ </span>
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+ <span class="summary_desc"><div class='inline'><p>
217
+ Type of the stream to identify the database.
218
+ </p>
219
+ </div></span>
220
+
221
+ </li>
222
+
223
+
224
+ </ul>
225
+
226
+
227
+
228
+
229
+
230
+ <h2>
231
+ Instance Method Summary
232
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
233
+ </h2>
234
+
235
+ <ul class="summary">
236
+
237
+ <li class="public ">
238
+ <span class="summary_signature">
239
+
240
+ <a href="#clean-instance_method" title="#clean (instance method)">- (Object) <strong>clean</strong> </a>
241
+
242
+
243
+
244
+ </span>
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ <span class="summary_desc"><div class='inline'><p>
255
+ Deletes the keys in the database to starts the FW empty.
256
+ </p>
257
+ </div></span>
258
+
259
+ </li>
260
+
261
+
262
+ <li class="public ">
263
+ <span class="summary_signature">
264
+
265
+ <a href="#connect_database-instance_method" title="#connect_database (instance method)">- (Object) <strong>connect_database</strong> </a>
266
+
267
+
268
+
269
+ </span>
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ <span class="summary_desc"><div class='inline'><p>
280
+ Connects to a redis database.
281
+ </p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#get_status-instance_method" title="#get_status (instance method)">- (String) <strong>get_status</strong> </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+ <span class="summary_desc"><div class='inline'><p>
305
+ Retrieves the next status that were saved in the database.
306
+ </p>
307
+ </div></span>
308
+
309
+ </li>
310
+
311
+
312
+ <li class="public ">
313
+ <span class="summary_signature">
314
+
315
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (DAO) <strong>initialize</strong>(type = 'twitter') </a>
316
+
317
+
318
+
319
+ </span>
320
+
321
+
322
+ <span class="note title constructor">constructor</span>
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+ <span class="summary_desc"><div class='inline'><p>
332
+ Config the DAO defining the Data Stream.
333
+ </p>
334
+ </div></span>
335
+
336
+ </li>
337
+
338
+
339
+ <li class="public ">
340
+ <span class="summary_signature">
341
+
342
+ <a href="#publish-instance_method" title="#publish (instance method)">- (Object) <strong>publish</strong>(usmf) </a>
343
+
344
+
345
+
346
+ </span>
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+ <span class="summary_desc"><div class='inline'><p>
357
+ Publish a message in the websocket server.
358
+ </p>
359
+ </div></span>
360
+
361
+ </li>
362
+
363
+
364
+ <li class="public ">
365
+ <span class="summary_signature">
366
+
367
+ <a href="#save_status-instance_method" title="#save_status (instance method)">- (Object) <strong>save_status</strong>(status) </a>
368
+
369
+
370
+
371
+ </span>
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+ <span class="summary_desc"><div class='inline'><p>
382
+ Persists the status into the database.
383
+ </p>
384
+ </div></span>
385
+
386
+ </li>
387
+
388
+
389
+ <li class="public ">
390
+ <span class="summary_signature">
391
+
392
+ <a href="#size-instance_method" title="#size (instance method)">- (Integer) <strong>size</strong> </a>
393
+
394
+
395
+
396
+ </span>
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+ <span class="summary_desc"><div class='inline'><p>
407
+ Returns the size of the database.
408
+ </p>
409
+ </div></span>
410
+
411
+ </li>
412
+
413
+
414
+ </ul>
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
427
+ <p class="inherited"><span class='object_link'><a href="Logging.html#logger-instance_method" title="Logging#logger (method)">#logger</a></span>, <span class='object_link'><a href="Logging.html#logger-class_method" title="Logging.logger (method)">logger</a></span></p>
428
+ <div id="constructor_details" class="method_details_list">
429
+ <h2>Constructor Details</h2>
430
+
431
+ <div class="method_details first">
432
+ <h3 class="signature first" id="initialize-instance_method">
433
+
434
+ - (<tt><span class='object_link'><a href="" title="DAO (class)">DAO</a></span></tt>) <strong>initialize</strong>(type = 'twitter')
435
+
436
+
437
+
438
+
439
+
440
+ </h3><div class="docstring">
441
+ <div class="discussion">
442
+ <p>
443
+ Config the DAO defining the Data Stream
444
+ </p>
445
+
446
+
447
+ </div>
448
+ </div>
449
+ <div class="tags">
450
+ <p class="tag_title">Parameters:</p>
451
+ <ul class="param">
452
+
453
+ <li>
454
+
455
+ <span class='name'>type</span>
456
+
457
+
458
+ <span class='type'>(<tt>String</tt>)</span>
459
+
460
+
461
+ <em class="default">(defaults to: <tt>'twitter'</tt>)</em>
462
+
463
+
464
+ &mdash;
465
+ <div class='inline'><p>
466
+ type of the Data Stream to choose the correct database
467
+ </p>
468
+ </div>
469
+
470
+ </li>
471
+
472
+ </ul>
473
+
474
+
475
+ </div><table class="source_code">
476
+ <tr>
477
+ <td>
478
+ <pre class="lines">
479
+
480
+
481
+ 24
482
+ 25
483
+ 26
484
+ 27
485
+ 28
486
+ 29
487
+ 30
488
+ 31
489
+ 32
490
+ 33
491
+ 34
492
+ 35</pre>
493
+ </td>
494
+ <td>
495
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 24</span>
496
+
497
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>twitter</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
498
+
499
+ <span class='ivar'>@type</span> <span class='op'>=</span> <span class='id identifier rubyid_type'>type</span>
500
+
501
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Starting DAO...</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
502
+
503
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> DAO in </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> type</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
504
+
505
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>config loaded OK</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
506
+ <span class='id identifier rubyid_connect_database'>connect_database</span>
507
+
508
+ <span class='kw'>end</span></pre>
509
+ </td>
510
+ </tr>
511
+ </table>
512
+ </div>
513
+
514
+ </div>
515
+
516
+ <div id="instance_attr_details" class="attr_details">
517
+ <h2>Instance Attribute Details</h2>
518
+
519
+
520
+ <span id="db=-instance_method"></span>
521
+ <div class="method_details first">
522
+ <h3 class="signature first" id="db-instance_method">
523
+
524
+ - (<tt>Redis</tt>) <strong>db</strong>
525
+
526
+
527
+
528
+
529
+
530
+ </h3><div class="docstring">
531
+ <div class="discussion">
532
+ <p>
533
+ An instance from a Redis DB with the redis gem
534
+ </p>
535
+
536
+
537
+ </div>
538
+ </div>
539
+ <div class="tags">
540
+
541
+ <p class="tag_title">Returns:</p>
542
+ <ul class="return">
543
+
544
+ <li>
545
+
546
+
547
+ <span class='type'>(<tt>Redis</tt>)</span>
548
+
549
+
550
+
551
+ &mdash;
552
+ <div class='inline'><p>
553
+ An instance from a Redis DB with the redis gem
554
+ </p>
555
+ </div>
556
+
557
+ </li>
558
+
559
+ </ul>
560
+
561
+ <p class="tag_title">See Also:</p>
562
+ <ul class="see">
563
+
564
+ <li><a href="http://rubydoc.info/gems/redis/3.0.1/frames" target="_parent" title="http://rubydoc.info/gems/redis/3.0.1/frames">http://rubydoc.info/gems/redis/3.0.1/frames</a></li>
565
+
566
+ </ul>
567
+
568
+ </div><table class="source_code">
569
+ <tr>
570
+ <td>
571
+ <pre class="lines">
572
+
573
+
574
+ 19
575
+ 20
576
+ 21</pre>
577
+ </td>
578
+ <td>
579
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 19</span>
580
+
581
+ <span class='kw'>def</span> <span class='id identifier rubyid_db'>db</span>
582
+ <span class='ivar'>@db</span>
583
+ <span class='kw'>end</span></pre>
584
+ </td>
585
+ </tr>
586
+ </table>
587
+ </div>
588
+
589
+
590
+ <span id="type=-instance_method"></span>
591
+ <div class="method_details ">
592
+ <h3 class="signature " id="type-instance_method">
593
+
594
+ - (<tt>String</tt>) <strong>type</strong>
595
+
596
+
597
+
598
+
599
+
600
+ </h3><div class="docstring">
601
+ <div class="discussion">
602
+ <p>
603
+ Type of the stream to identify the database
604
+ </p>
605
+
606
+
607
+ </div>
608
+ </div>
609
+ <div class="tags">
610
+
611
+ <p class="tag_title">Returns:</p>
612
+ <ul class="return">
613
+
614
+ <li>
615
+
616
+
617
+ <span class='type'>(<tt>String</tt>)</span>
618
+
619
+
620
+
621
+ &mdash;
622
+ <div class='inline'><p>
623
+ Type of the stream to identify the database
624
+ </p>
625
+ </div>
626
+
627
+ </li>
628
+
629
+ </ul>
630
+
631
+ </div><table class="source_code">
632
+ <tr>
633
+ <td>
634
+ <pre class="lines">
635
+
636
+
637
+ 14
638
+ 15
639
+ 16</pre>
640
+ </td>
641
+ <td>
642
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 14</span>
643
+
644
+ <span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
645
+ <span class='ivar'>@type</span>
646
+ <span class='kw'>end</span></pre>
647
+ </td>
648
+ </tr>
649
+ </table>
650
+ </div>
651
+
652
+ </div>
653
+
654
+
655
+ <div id="instance_method_details" class="method_details_list">
656
+ <h2>Instance Method Details</h2>
657
+
658
+
659
+ <div class="method_details first">
660
+ <h3 class="signature first" id="clean-instance_method">
661
+
662
+ - (<tt>Object</tt>) <strong>clean</strong>
663
+
664
+
665
+
666
+
667
+
668
+ </h3><div class="docstring">
669
+ <div class="discussion">
670
+
671
+ <div class="note notetag">
672
+ <strong>Note:</strong>
673
+ <div class='inline'><p>
674
+ if the user develops more Streams, add the new keys like the existing ones
675
+ </p>
676
+ </div>
677
+ </div>
678
+
679
+ <p>
680
+ Deletes the keys in the database to starts the FW empty
681
+ </p>
682
+
683
+
684
+ </div>
685
+ </div>
686
+ <div class="tags">
687
+
688
+
689
+ </div><table class="source_code">
690
+ <tr>
691
+ <td>
692
+ <pre class="lines">
693
+
694
+
695
+ 64
696
+ 65
697
+ 66
698
+ 67
699
+ 68</pre>
700
+ </td>
701
+ <td>
702
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 64</span>
703
+
704
+ <span class='kw'>def</span> <span class='id identifier rubyid_clean'>clean</span>
705
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>cleaning the db</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
706
+ <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_del'>del</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>twitter</span><span class='tstring_end'>'</span></span>
707
+ <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_del'>del</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rpg</span><span class='tstring_end'>'</span></span>
708
+ <span class='kw'>end</span></pre>
709
+ </td>
710
+ </tr>
711
+ </table>
712
+ </div>
713
+
714
+ <div class="method_details ">
715
+ <h3 class="signature " id="connect_database-instance_method">
716
+
717
+ - (<tt>Object</tt>) <strong>connect_database</strong>
718
+
719
+
720
+
721
+
722
+
723
+ </h3><div class="docstring">
724
+ <div class="discussion">
725
+ <p>
726
+ Connects to a redis database
727
+ </p>
728
+
729
+
730
+ </div>
731
+ </div>
732
+ <div class="tags">
733
+
734
+
735
+ </div><table class="source_code">
736
+ <tr>
737
+ <td>
738
+ <pre class="lines">
739
+
740
+
741
+ 38
742
+ 39
743
+ 40
744
+ 41
745
+ 42
746
+ 43
747
+ 44
748
+ 45
749
+ 46
750
+ 47
751
+ 48
752
+ 49
753
+ 50
754
+ 51</pre>
755
+ </td>
756
+ <td>
757
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 38</span>
758
+
759
+ <span class='kw'>def</span> <span class='id identifier rubyid_connect_database'>connect_database</span>
760
+ <span class='ivar'>@db</span> <span class='op'>=</span> <span class='const'>Redis</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
761
+
762
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>New instance for Redis</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
763
+
764
+ <span class='ivar'>@db</span> <span class='op'>=</span> <span class='const'>Redis</span><span class='period'>.</span><span class='id identifier rubyid_connect'>connect</span><span class='lparen'>(</span>
765
+ <span class='symbol'>:db</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
766
+ <span class='symbol'>:host</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
767
+ <span class='symbol'>:port</span> <span class='op'>=&gt;</span> <span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='comma'>,</span>
768
+ <span class='symbol'>:password</span> <span class='op'>=&gt;</span> <span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_password'>password</span>
769
+ <span class='rparen'>)</span>
770
+
771
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Redis connect OK</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
772
+ <span class='kw'>end</span></pre>
773
+ </td>
774
+ </tr>
775
+ </table>
776
+ </div>
777
+
778
+ <div class="method_details ">
779
+ <h3 class="signature " id="get_status-instance_method">
780
+
781
+ - (<tt>String</tt>) <strong>get_status</strong>
782
+
783
+
784
+
785
+
786
+
787
+ </h3><div class="docstring">
788
+ <div class="discussion">
789
+ <p>
790
+ Retrieves the next status that were saved in the database
791
+ </p>
792
+
793
+
794
+ </div>
795
+ </div>
796
+ <div class="tags">
797
+
798
+ <p class="tag_title">Returns:</p>
799
+ <ul class="return">
800
+
801
+ <li>
802
+
803
+
804
+ <span class='type'>(<tt>String</tt>)</span>
805
+
806
+
807
+
808
+ &mdash;
809
+ <div class='inline'><p>
810
+ the status from the Adapter
811
+ </p>
812
+ </div>
813
+
814
+ </li>
815
+
816
+ </ul>
817
+
818
+ </div><table class="source_code">
819
+ <tr>
820
+ <td>
821
+ <pre class="lines">
822
+
823
+
824
+ 56
825
+ 57
826
+ 58
827
+ 59
828
+ 60</pre>
829
+ </td>
830
+ <td>
831
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 56</span>
832
+
833
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_status'>get_status</span>
834
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>getting status</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
835
+ <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_rpop'>rpop</span> <span class='ivar'>@type</span>
836
+ <span class='id identifier rubyid_status'>status</span>
837
+ <span class='kw'>end</span></pre>
838
+ </td>
839
+ </tr>
840
+ </table>
841
+ </div>
842
+
843
+ <div class="method_details ">
844
+ <h3 class="signature " id="publish-instance_method">
845
+
846
+ - (<tt>Object</tt>) <strong>publish</strong>(usmf)
847
+
848
+
849
+
850
+
851
+
852
+ </h3><div class="docstring">
853
+ <div class="discussion">
854
+ <p>
855
+ Publish a message in the websocket server
856
+ </p>
857
+
858
+
859
+ </div>
860
+ </div>
861
+ <div class="tags">
862
+ <p class="tag_title">Parameters:</p>
863
+ <ul class="param">
864
+
865
+ <li>
866
+
867
+ <span class='name'>usmf</span>
868
+
869
+
870
+ <span class='type'>(<tt><span class='object_link'><a href="USMF.html" title="USMF (class)">USMF</a></span></tt>)</span>
871
+
872
+
873
+
874
+ &mdash;
875
+ <div class='inline'><p>
876
+ a message to publish
877
+ </p>
878
+ </div>
879
+
880
+ </li>
881
+
882
+ </ul>
883
+
884
+
885
+ </div><table class="source_code">
886
+ <tr>
887
+ <td>
888
+ <pre class="lines">
889
+
890
+
891
+ 89
892
+ 90
893
+ 91
894
+ 92</pre>
895
+ </td>
896
+ <td>
897
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 89</span>
898
+
899
+ <span class='kw'>def</span> <span class='id identifier rubyid_publish'>publish</span> <span class='id identifier rubyid_usmf'>usmf</span>
900
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Publishing</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
901
+ <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_publish'>publish</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ws</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_usmf'>usmf</span>
902
+ <span class='kw'>end</span></pre>
903
+ </td>
904
+ </tr>
905
+ </table>
906
+ </div>
907
+
908
+ <div class="method_details ">
909
+ <h3 class="signature " id="save_status-instance_method">
910
+
911
+ - (<tt>Object</tt>) <strong>save_status</strong>(status)
912
+
913
+
914
+
915
+
916
+
917
+ </h3><div class="docstring">
918
+ <div class="discussion">
919
+ <p>
920
+ Persists the status into the database
921
+ </p>
922
+
923
+
924
+ </div>
925
+ </div>
926
+ <div class="tags">
927
+ <p class="tag_title">Parameters:</p>
928
+ <ul class="param">
929
+
930
+ <li>
931
+
932
+ <span class='name'>status</span>
933
+
934
+
935
+ <span class='type'>(<tt>String</tt>)</span>
936
+
937
+
938
+
939
+ &mdash;
940
+ <div class='inline'><p>
941
+ the status to persist it
942
+ </p>
943
+ </div>
944
+
945
+ </li>
946
+
947
+ </ul>
948
+
949
+
950
+ </div><table class="source_code">
951
+ <tr>
952
+ <td>
953
+ <pre class="lines">
954
+
955
+
956
+ 73
957
+ 74
958
+ 75
959
+ 76</pre>
960
+ </td>
961
+ <td>
962
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 73</span>
963
+
964
+ <span class='kw'>def</span> <span class='id identifier rubyid_save_status'>save_status</span> <span class='id identifier rubyid_status'>status</span>
965
+ <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_rpush'>rpush</span> <span class='ivar'>@type</span><span class='comma'>,</span> <span class='id identifier rubyid_status'>status</span>
966
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Status saved</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
967
+ <span class='kw'>end</span></pre>
968
+ </td>
969
+ </tr>
970
+ </table>
971
+ </div>
972
+
973
+ <div class="method_details ">
974
+ <h3 class="signature " id="size-instance_method">
975
+
976
+ - (<tt>Integer</tt>) <strong>size</strong>
977
+
978
+
979
+
980
+
981
+
982
+ </h3><div class="docstring">
983
+ <div class="discussion">
984
+ <p>
985
+ Returns the size of the database
986
+ </p>
987
+
988
+
989
+ </div>
990
+ </div>
991
+ <div class="tags">
992
+
993
+ <p class="tag_title">Returns:</p>
994
+ <ul class="return">
995
+
996
+ <li>
997
+
998
+
999
+ <span class='type'>(<tt>Integer</tt>)</span>
1000
+
1001
+
1002
+
1003
+ &mdash;
1004
+ <div class='inline'><p>
1005
+ the size (items) of the database
1006
+ </p>
1007
+ </div>
1008
+
1009
+ </li>
1010
+
1011
+ </ul>
1012
+
1013
+ </div><table class="source_code">
1014
+ <tr>
1015
+ <td>
1016
+ <pre class="lines">
1017
+
1018
+
1019
+ 81
1020
+ 82
1021
+ 83
1022
+ 84</pre>
1023
+ </td>
1024
+ <td>
1025
+ <pre class="code"><span class="info file"># File 'lib/helper/DAO.rb', line 81</span>
1026
+
1027
+ <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
1028
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>getting size</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1029
+ <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_llen'>llen</span> <span class='ivar'>@type</span>
1030
+ <span class='kw'>end</span></pre>
1031
+ </td>
1032
+ </tr>
1033
+ </table>
1034
+ </div>
1035
+
1036
+ </div>
1037
+
1038
+ </div>
1039
+
1040
+ <div id="footer">
1041
+ Generated on Sat Aug 18 16:24:08 2012 by
1042
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1043
+ 0.8.2.1 (ruby-1.9.2).
1044
+ </div>
1045
+
1046
+ </body>
1047
+ </html>