kermit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,501 @@
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: RandomAdapter
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 (R)</a> &raquo;
35
+
36
+
37
+ <span class="title">RandomAdapter</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: RandomAdapter
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"><span class='object_link'><a href="Adapter.html" title="Adapter (class)">Adapter</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next"><span class='object_link'><a href="Adapter.html" title="Adapter (class)">Adapter</a></span></li>
82
+
83
+ <li class="next">RandomAdapter</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dt class="r2">Includes:</dt>
96
+ <dd class="r2"><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></dd>
97
+
98
+
99
+
100
+
101
+
102
+ <dt class="r1 last">Defined in:</dt>
103
+ <dd class="r1 last">lib/business/adapter/random_adapter.rb</dd>
104
+
105
+ </dl>
106
+ <div class="clear"></div>
107
+
108
+ <h2>Overview</h2><div class="docstring">
109
+ <div class="discussion">
110
+ <p>
111
+ Self implementation from Adapter class to make it works with a Random
112
+ Phrase Generator
113
+ </p>
114
+
115
+
116
+ </div>
117
+ </div>
118
+ <div class="tags">
119
+
120
+ <p class="tag_title">Author:</p>
121
+ <ul class="author">
122
+
123
+ <li>
124
+
125
+
126
+
127
+
128
+
129
+ <div class='inline'><p>
130
+ Daniel Machado Fernandez
131
+ </p>
132
+ </div>
133
+
134
+ </li>
135
+
136
+ </ul>
137
+ <p class="tag_title">Version:</p>
138
+ <ul class="version">
139
+
140
+ <li>
141
+
142
+
143
+
144
+
145
+
146
+ <div class='inline'><p>
147
+ 1.0
148
+ </p>
149
+ </div>
150
+
151
+ </li>
152
+
153
+ </ul>
154
+
155
+ </div>
156
+ <h2>Constant Summary</h2>
157
+
158
+
159
+
160
+
161
+ <h2>Constant Summary</h2>
162
+
163
+ <h3 class="inherited">Constants included
164
+ from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
165
+ <p class="inherited"><span class='object_link'><a href="Logging.html#KermitPFC-constant" title="Logging::KermitPFC (constant)">Logging::KermitPFC</a></span></p>
166
+
167
+
168
+
169
+
170
+
171
+
172
+ <h2>
173
+ Instance Method Summary
174
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
175
+ </h2>
176
+
177
+ <ul class="summary">
178
+
179
+ <li class="public ">
180
+ <span class="summary_signature">
181
+
182
+ <a href="#connect_stream-instance_method" title="#connect_stream (instance method)">- (Object) <strong>connect_stream</strong>(stream = 1) </a>
183
+
184
+
185
+
186
+ </span>
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <span class="summary_desc"><div class='inline'><p>
197
+ Connects to a Random Phrase Generator and retrieves phrases.
198
+ </p>
199
+ </div></span>
200
+
201
+ </li>
202
+
203
+
204
+ <li class="public ">
205
+ <span class="summary_signature">
206
+
207
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (RandomAdapter) <strong>initialize</strong> </a>
208
+
209
+
210
+
211
+ </span>
212
+
213
+
214
+ <span class="note title constructor">constructor</span>
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <span class="summary_desc"><div class='inline'><p>
224
+ Initializes the Random Adapter class with the dao parameters.
225
+ </p>
226
+ </div></span>
227
+
228
+ </li>
229
+
230
+
231
+ <li class="public ">
232
+ <span class="summary_signature">
233
+
234
+ <a href="#persist-instance_method" title="#persist (instance method)">- (Object) <strong>persist</strong>(status) </a>
235
+
236
+
237
+
238
+ </span>
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'><p>
249
+ Save the status in a database to release the execution charge of threat
250
+ that info in real time.
251
+ </p>
252
+ </div></span>
253
+
254
+ </li>
255
+
256
+
257
+ </ul>
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
270
+ <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>
271
+
272
+
273
+
274
+
275
+
276
+
277
+ <div id="constructor_details" class="method_details_list">
278
+ <h2>Constructor Details</h2>
279
+
280
+ <div class="method_details first">
281
+ <h3 class="signature first" id="initialize-instance_method">
282
+
283
+ - (<tt><span class='object_link'><a href="" title="RandomAdapter (class)">RandomAdapter</a></span></tt>) <strong>initialize</strong>
284
+
285
+
286
+
287
+
288
+
289
+ </h3><div class="docstring">
290
+ <div class="discussion">
291
+ <p>
292
+ Initializes the Random Adapter class with the dao parameters
293
+ </p>
294
+
295
+
296
+ </div>
297
+ </div>
298
+ <div class="tags">
299
+
300
+
301
+ </div><table class="source_code">
302
+ <tr>
303
+ <td>
304
+ <pre class="lines">
305
+
306
+
307
+ 15
308
+ 16
309
+ 17
310
+ 18
311
+ 19
312
+ 20</pre>
313
+ </td>
314
+ <td>
315
+ <pre class="code"><span class="info file"># File 'lib/business/adapter/random_adapter.rb', line 15</span>
316
+
317
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
318
+
319
+ <span class='ivar'>@dao</span> <span class='op'>=</span> <span class='const'>DAO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rpg</span><span class='tstring_end'>'</span></span>
320
+ <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 RandomAdapter...</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
321
+
322
+ <span class='kw'>end</span></pre>
323
+ </td>
324
+ </tr>
325
+ </table>
326
+ </div>
327
+
328
+ </div>
329
+
330
+
331
+ <div id="instance_method_details" class="method_details_list">
332
+ <h2>Instance Method Details</h2>
333
+
334
+
335
+ <div class="method_details first">
336
+ <h3 class="signature first" id="connect_stream-instance_method">
337
+
338
+ - (<tt>Object</tt>) <strong>connect_stream</strong>(stream = 1)
339
+
340
+
341
+
342
+
343
+
344
+ </h3><div class="docstring">
345
+ <div class="discussion">
346
+ <p>
347
+ Connects to a Random Phrase Generator and retrieves phrases
348
+ </p>
349
+
350
+
351
+ </div>
352
+ </div>
353
+ <div class="tags">
354
+ <p class="tag_title">Parameters:</p>
355
+ <ul class="param">
356
+
357
+ <li>
358
+
359
+ <span class='name'>stream</span>
360
+
361
+
362
+ <span class='type'>(<tt>Integer</tt>)</span>
363
+
364
+
365
+ <em class="default">(defaults to: <tt>1</tt>)</em>
366
+
367
+
368
+ &mdash;
369
+ <div class='inline'><p>
370
+ number of the stream
371
+ </p>
372
+ </div>
373
+
374
+ </li>
375
+
376
+ </ul>
377
+
378
+
379
+ </div><table class="source_code">
380
+ <tr>
381
+ <td>
382
+ <pre class="lines">
383
+
384
+
385
+ 26
386
+ 27
387
+ 28
388
+ 29
389
+ 30
390
+ 31
391
+ 32
392
+ 33
393
+ 34
394
+ 35
395
+ 36
396
+ 37
397
+ 38
398
+ 39
399
+ 40
400
+ 41</pre>
401
+ </td>
402
+ <td>
403
+ <pre class="code"><span class="info file"># File 'lib/business/adapter/random_adapter.rb', line 26</span>
404
+
405
+ <span class='kw'>def</span> <span class='id identifier rubyid_connect_stream'>connect_stream</span> <span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
406
+
407
+ <span class='id identifier rubyid_random'>random</span> <span class='op'>=</span> <span class='const'>RandomPhraseGenerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
408
+ <span class='id identifier rubyid_i'>i</span><span class='op'>=</span><span class='int'>0</span>
409
+ <span class='kw'>while</span> <span class='kw'>true</span>
410
+
411
+ <span class='id identifier rubyid_persist'>persist</span> <span class='id identifier rubyid_random'>random</span><span class='period'>.</span><span class='id identifier rubyid_generate'>generate</span>
412
+ <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'>retrieving...</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
413
+ <span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='id identifier rubyid_i'>i</span><span class='op'>+</span><span class='int'>1</span>
414
+ <span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='int'>10</span> <span class='op'>==</span> <span class='int'>0</span>
415
+ <span class='id identifier rubyid_sleep'>sleep</span> <span class='int'>10</span>
416
+ <span class='kw'>end</span>
417
+
418
+ <span class='kw'>end</span>
419
+
420
+ <span class='kw'>end</span></pre>
421
+ </td>
422
+ </tr>
423
+ </table>
424
+ </div>
425
+
426
+ <div class="method_details ">
427
+ <h3 class="signature " id="persist-instance_method">
428
+
429
+ - (<tt>Object</tt>) <strong>persist</strong>(status)
430
+
431
+
432
+
433
+
434
+
435
+ </h3><div class="docstring">
436
+ <div class="discussion">
437
+ <p>
438
+ Save the status in a database to release the execution charge of threat
439
+ that info in real time
440
+ </p>
441
+
442
+
443
+ </div>
444
+ </div>
445
+ <div class="tags">
446
+ <p class="tag_title">Parameters:</p>
447
+ <ul class="param">
448
+
449
+ <li>
450
+
451
+ <span class='name'>status</span>
452
+
453
+
454
+ <span class='type'>(<tt>String</tt>)</span>
455
+
456
+
457
+
458
+ &mdash;
459
+ <div class='inline'><p>
460
+ the status to persist
461
+ </p>
462
+ </div>
463
+
464
+ </li>
465
+
466
+ </ul>
467
+
468
+
469
+ </div><table class="source_code">
470
+ <tr>
471
+ <td>
472
+ <pre class="lines">
473
+
474
+
475
+ 46
476
+ 47
477
+ 48</pre>
478
+ </td>
479
+ <td>
480
+ <pre class="code"><span class="info file"># File 'lib/business/adapter/random_adapter.rb', line 46</span>
481
+
482
+ <span class='kw'>def</span> <span class='id identifier rubyid_persist'>persist</span> <span class='id identifier rubyid_status'>status</span>
483
+ <span class='ivar'>@dao</span><span class='period'>.</span><span class='id identifier rubyid_save_status'>save_status</span> <span class='id identifier rubyid_status'>status</span>
484
+ <span class='kw'>end</span></pre>
485
+ </td>
486
+ </tr>
487
+ </table>
488
+ </div>
489
+
490
+ </div>
491
+
492
+ </div>
493
+
494
+ <div id="footer">
495
+ Generated on Sat Aug 18 16:24:08 2012 by
496
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
497
+ 0.8.2.1 (ruby-1.9.2).
498
+ </div>
499
+
500
+ </body>
501
+ </html>