riaction 1.2.6 → 1.2.7

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 (51) hide show
  1. data/.yardoc/checksums +11 -0
  2. data/.yardoc/objects/root.dat +0 -0
  3. data/.yardoc/proxy_types +0 -0
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile.lock +12 -8
  6. data/README.md +6 -1
  7. data/db/riaction.db +0 -0
  8. data/doc/Riaction/ConfigurationError.html +116 -0
  9. data/doc/Riaction/Constants.html +389 -0
  10. data/doc/Riaction/CrudEventCallback.html +402 -0
  11. data/doc/Riaction/EventPerformer.html +250 -0
  12. data/doc/Riaction/NoEventDefined.html +116 -0
  13. data/doc/Riaction/NoProfileDefined.html +116 -0
  14. data/doc/Riaction/ProfileCreationCallback.html +192 -0
  15. data/doc/Riaction/ProfileCreator.html +235 -0
  16. data/doc/Riaction/Railtie.html +116 -0
  17. data/doc/Riaction/Riaction/ClassMethods.html +837 -0
  18. data/doc/Riaction/Riaction/Event/InstanceMethods.html +301 -0
  19. data/doc/Riaction/Riaction/Event.html +108 -0
  20. data/doc/Riaction/Riaction/InstanceMethods.html +198 -0
  21. data/doc/Riaction/Riaction/Profile/InstanceMethods.html +746 -0
  22. data/doc/Riaction/Riaction/Profile.html +108 -0
  23. data/doc/Riaction/Riaction.html +125 -0
  24. data/doc/Riaction/RuntimeError.html +116 -0
  25. data/doc/Riaction.html +124 -0
  26. data/doc/RiactionGenerator.html +188 -0
  27. data/doc/_index.html +263 -0
  28. data/doc/class_list.html +47 -0
  29. data/doc/css/common.css +1 -0
  30. data/doc/css/full_list.css +55 -0
  31. data/doc/css/style.css +322 -0
  32. data/doc/file.README.html +304 -0
  33. data/doc/file_list.html +49 -0
  34. data/doc/frames.html +13 -0
  35. data/doc/index.html +304 -0
  36. data/doc/js/app.js +205 -0
  37. data/doc/js/full_list.js +173 -0
  38. data/doc/js/jquery.js +16 -0
  39. data/doc/method_list.html +294 -0
  40. data/doc/top-level-namespace.html +107 -0
  41. data/lib/riaction/constants.rb +6 -2
  42. data/lib/riaction/crud_event_callback.rb +3 -0
  43. data/lib/riaction/event_performer.rb +10 -5
  44. data/lib/riaction/profile_creation_callback.rb +2 -0
  45. data/lib/riaction/riaction.rb +11 -7
  46. data/lib/riaction/version.rb +1 -1
  47. data/lib/tasks/riaction.rake +25 -22
  48. data/riaction.gemspec +4 -2
  49. data/spec/event_performer_spec.rb +23 -0
  50. data/spec/riaction_spec.rb +33 -4
  51. metadata +79 -19
@@ -0,0 +1,402 @@
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: Riaction::CrudEventCallback
8
+
9
+ &mdash; Documentation by YARD 0.7.5
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
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
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>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (C)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Riaction.html" title="Riaction (module)">Riaction</a></span></span>
38
+ &raquo;
39
+ <span class="title">CrudEventCallback</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: Riaction::CrudEventCallback
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">Riaction::CrudEventCallback</li>
75
+
76
+ </ul>
77
+ <a href="#" class="inheritanceTree">show all</a>
78
+
79
+ </dd>
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ <dt class="r2 last">Defined in:</dt>
90
+ <dd class="r2 last">lib/riaction/crud_event_callback.rb</dd>
91
+
92
+ </dl>
93
+ <div class="clear"></div>
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <h2>
104
+ Instance Method Summary
105
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
106
+ </h2>
107
+
108
+ <ul class="summary">
109
+
110
+ <li class="public ">
111
+ <span class="summary_signature">
112
+
113
+ <a href="#after_create-instance_method" title="#after_create (instance method)">- (Object) <strong>after_create</strong>(record) </a>
114
+
115
+
116
+
117
+ </span>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <span class="summary_desc"><div class='inline'>
127
+ <p>Enqueues a Riaction::EventPerformer object in resque after a model has been
128
+ created.</p>
129
+ </div></span>
130
+
131
+ </li>
132
+
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature">
136
+
137
+ <a href="#after_destroy-instance_method" title="#after_destroy (instance method)">- (Object) <strong>after_destroy</strong>(record) </a>
138
+
139
+
140
+
141
+ </span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'>
151
+ <p>Enqueues a Riaction::EventPerformer object in resque after a model has been
152
+ destroyed.</p>
153
+ </div></span>
154
+
155
+ </li>
156
+
157
+
158
+ <li class="public ">
159
+ <span class="summary_signature">
160
+
161
+ <a href="#after_update-instance_method" title="#after_update (instance method)">- (Object) <strong>after_update</strong>(record) </a>
162
+
163
+
164
+
165
+ </span>
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <span class="summary_desc"><div class='inline'>
175
+ <p>Enqueues a Riaction::EventPerformer object in resque after a model has been
176
+ updated.</p>
177
+ </div></span>
178
+
179
+ </li>
180
+
181
+
182
+ <li class="public ">
183
+ <span class="summary_signature">
184
+
185
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (CrudEventCallback) <strong>initialize</strong>(event_name) </a>
186
+
187
+
188
+
189
+ </span>
190
+
191
+ <span class="note title constructor">constructor</span>
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'>
201
+ <p>A new instance of CrudEventCallback.</p>
202
+ </div></span>
203
+
204
+ </li>
205
+
206
+
207
+ </ul>
208
+
209
+
210
+ <div id="constructor_details" class="method_details_list">
211
+ <h2>Constructor Details</h2>
212
+
213
+ <div class="method_details first">
214
+ <p class="signature first" id="initialize-instance_method">
215
+
216
+ - (<tt><span class='object_link'><a href="" title="Riaction::CrudEventCallback (class)">CrudEventCallback</a></span></tt>) <strong>initialize</strong>(event_name)
217
+
218
+
219
+
220
+ </p><div class="docstring">
221
+ <div class="discussion">
222
+
223
+ <p>A new instance of CrudEventCallback</p>
224
+
225
+
226
+ </div>
227
+ </div>
228
+ <div class="tags">
229
+
230
+
231
+ </div><table class="source_code">
232
+ <tr>
233
+ <td>
234
+ <pre class="lines">
235
+
236
+
237
+ 6
238
+ 7
239
+ 8</pre>
240
+ </td>
241
+ <td>
242
+ <pre class="code"><span class="info file"># File 'lib/riaction/crud_event_callback.rb', line 6</span>
243
+
244
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rparen'>)</span>
245
+ <span class='ivar'>@event_name</span> <span class='op'>=</span> <span class='id identifier rubyid_event_name'>event_name</span>
246
+ <span class='kw'>end</span></pre>
247
+ </td>
248
+ </tr>
249
+ </table>
250
+ </div>
251
+
252
+ </div>
253
+
254
+
255
+ <div id="instance_method_details" class="method_details_list">
256
+ <h2>Instance Method Details</h2>
257
+
258
+
259
+ <div class="method_details first">
260
+ <p class="signature first" id="after_create-instance_method">
261
+
262
+ - (<tt>Object</tt>) <strong>after_create</strong>(record)
263
+
264
+
265
+
266
+ </p><div class="docstring">
267
+ <div class="discussion">
268
+
269
+ <p>Enqueues a Riaction::EventPerformer object in resque after a model has been
270
+ created</p>
271
+
272
+
273
+ </div>
274
+ </div>
275
+ <div class="tags">
276
+
277
+
278
+ </div><table class="source_code">
279
+ <tr>
280
+ <td>
281
+ <pre class="lines">
282
+
283
+
284
+ 11
285
+ 12
286
+ 13
287
+ 14
288
+ 15</pre>
289
+ </td>
290
+ <td>
291
+ <pre class="code"><span class="info file"># File 'lib/riaction/crud_event_callback.rb', line 11</span>
292
+
293
+ <span class='kw'>def</span> <span class='id identifier rubyid_after_create'>after_create</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
294
+ <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_riaction_log_event?'>riaction_log_event?</span><span class='lparen'>(</span><span class='ivar'>@event_name</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_riactionless?'>riactionless?</span>
295
+ <span class='const'>Resque</span><span class='period'>.</span><span class='id identifier rubyid_enqueue'>enqueue</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Riaction</span><span class='op'>::</span><span class='const'>EventPerformer</span><span class='comma'>,</span> <span class='ivar'>@event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_class'>base_class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
296
+ <span class='kw'>end</span>
297
+ <span class='kw'>end</span></pre>
298
+ </td>
299
+ </tr>
300
+ </table>
301
+ </div>
302
+
303
+ <div class="method_details ">
304
+ <p class="signature " id="after_destroy-instance_method">
305
+
306
+ - (<tt>Object</tt>) <strong>after_destroy</strong>(record)
307
+
308
+
309
+
310
+ </p><div class="docstring">
311
+ <div class="discussion">
312
+
313
+ <p>Enqueues a Riaction::EventPerformer object in resque after a model has been
314
+ destroyed</p>
315
+
316
+
317
+ </div>
318
+ </div>
319
+ <div class="tags">
320
+
321
+
322
+ </div><table class="source_code">
323
+ <tr>
324
+ <td>
325
+ <pre class="lines">
326
+
327
+
328
+ 25
329
+ 26
330
+ 27
331
+ 28
332
+ 29</pre>
333
+ </td>
334
+ <td>
335
+ <pre class="code"><span class="info file"># File 'lib/riaction/crud_event_callback.rb', line 25</span>
336
+
337
+ <span class='kw'>def</span> <span class='id identifier rubyid_after_destroy'>after_destroy</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
338
+ <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_riaction_log_event?'>riaction_log_event?</span><span class='lparen'>(</span><span class='ivar'>@event_name</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_riactionless?'>riactionless?</span>
339
+ <span class='const'>Resque</span><span class='period'>.</span><span class='id identifier rubyid_enqueue'>enqueue</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Riaction</span><span class='op'>::</span><span class='const'>EventPerformer</span><span class='comma'>,</span> <span class='ivar'>@event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_class'>base_class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
340
+ <span class='kw'>end</span>
341
+ <span class='kw'>end</span></pre>
342
+ </td>
343
+ </tr>
344
+ </table>
345
+ </div>
346
+
347
+ <div class="method_details ">
348
+ <p class="signature " id="after_update-instance_method">
349
+
350
+ - (<tt>Object</tt>) <strong>after_update</strong>(record)
351
+
352
+
353
+
354
+ </p><div class="docstring">
355
+ <div class="discussion">
356
+
357
+ <p>Enqueues a Riaction::EventPerformer object in resque after a model has been
358
+ updated</p>
359
+
360
+
361
+ </div>
362
+ </div>
363
+ <div class="tags">
364
+
365
+
366
+ </div><table class="source_code">
367
+ <tr>
368
+ <td>
369
+ <pre class="lines">
370
+
371
+
372
+ 18
373
+ 19
374
+ 20
375
+ 21
376
+ 22</pre>
377
+ </td>
378
+ <td>
379
+ <pre class="code"><span class="info file"># File 'lib/riaction/crud_event_callback.rb', line 18</span>
380
+
381
+ <span class='kw'>def</span> <span class='id identifier rubyid_after_update'>after_update</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
382
+ <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_riaction_log_event?'>riaction_log_event?</span><span class='lparen'>(</span><span class='ivar'>@event_name</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_riactionless?'>riactionless?</span>
383
+ <span class='const'>Resque</span><span class='period'>.</span><span class='id identifier rubyid_enqueue'>enqueue</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Riaction</span><span class='op'>::</span><span class='const'>EventPerformer</span><span class='comma'>,</span> <span class='ivar'>@event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_class'>base_class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
384
+ <span class='kw'>end</span>
385
+ <span class='kw'>end</span></pre>
386
+ </td>
387
+ </tr>
388
+ </table>
389
+ </div>
390
+
391
+ </div>
392
+
393
+ </div>
394
+
395
+ <div id="footer">
396
+ Generated on Tue Mar 6 22:00:20 2012 by
397
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
398
+ 0.7.5 (ruby-1.9.3).
399
+ </div>
400
+
401
+ </body>
402
+ </html>
@@ -0,0 +1,250 @@
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: Riaction::EventPerformer
8
+
9
+ &mdash; Documentation by YARD 0.7.5
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
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
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>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (E)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Riaction.html" title="Riaction (module)">Riaction</a></span></span>
38
+ &raquo;
39
+ <span class="title">EventPerformer</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: Riaction::EventPerformer
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">Riaction::EventPerformer</li>
75
+
76
+ </ul>
77
+ <a href="#" class="inheritanceTree">show all</a>
78
+
79
+ </dd>
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ <dt class="r2 last">Defined in:</dt>
90
+ <dd class="r2 last">lib/riaction/event_performer.rb</dd>
91
+
92
+ </dl>
93
+ <div class="clear"></div>
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <h2>
104
+ Class Method Summary
105
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
106
+ </h2>
107
+
108
+ <ul class="summary">
109
+
110
+ <li class="public ">
111
+ <span class="summary_signature">
112
+
113
+ <a href="#perform-class_method" title="perform (class method)">+ (Object) <strong>perform</strong>(event_name, klass_name, id, attempt = 0) </a>
114
+
115
+
116
+
117
+ </span>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <span class="summary_desc"><div class='inline'>
127
+ <p>Sends an event to IActionable based on the name of a riaction class and the
128
+ ID used to locate the instance.</p>
129
+ </div></span>
130
+
131
+ </li>
132
+
133
+
134
+ </ul>
135
+
136
+
137
+
138
+
139
+ <div id="class_method_details" class="method_details_list">
140
+ <h2>Class Method Details</h2>
141
+
142
+
143
+ <div class="method_details first">
144
+ <p class="signature first" id="perform-class_method">
145
+
146
+ + (<tt>Object</tt>) <strong>perform</strong>(event_name, klass_name, id, attempt = 0)
147
+
148
+
149
+
150
+ </p><div class="docstring">
151
+ <div class="discussion">
152
+
153
+ <p>Sends an event to IActionable based on the name of a riaction class and the
154
+ ID used to locate the instance</p>
155
+
156
+ <p>@<a href="http://String">param</a> event_name something</p>
157
+
158
+
159
+ </div>
160
+ </div>
161
+ <div class="tags">
162
+
163
+
164
+ </div><table class="source_code">
165
+ <tr>
166
+ <td>
167
+ <pre class="lines">
168
+
169
+
170
+ 11
171
+ 12
172
+ 13
173
+ 14
174
+ 15
175
+ 16
176
+ 17
177
+ 18
178
+ 19
179
+ 20
180
+ 21
181
+ 22
182
+ 23
183
+ 24
184
+ 25
185
+ 26
186
+ 27
187
+ 28
188
+ 29
189
+ 30
190
+ 31
191
+ 32
192
+ 33
193
+ 34
194
+ 35
195
+ 36
196
+ 37
197
+ 38
198
+ 39
199
+ 40</pre>
200
+ </td>
201
+ <td>
202
+ <pre class="code"><span class="info file"># File 'lib/riaction/event_performer.rb', line 11</span>
203
+
204
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_klass_name'>klass_name</span><span class='comma'>,</span> <span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_attempt'>attempt</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
205
+ <span class='id identifier rubyid_event_name_sym'>event_name_sym</span> <span class='op'>=</span> <span class='id identifier rubyid_event_name'>event_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
206
+ <span class='id identifier rubyid_iactionable_api'>iactionable_api</span> <span class='op'>=</span> <span class='const'>IActionable</span><span class='op'>::</span><span class='const'>Api</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
207
+ <span class='id identifier rubyid_event_object'>event_object</span> <span class='op'>=</span> <span class='id identifier rubyid_klass_name'>klass_name</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span><span class='period'>.</span><span class='id identifier rubyid_find_by_id!'>find_by_id!</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
208
+ <span class='id identifier rubyid_event_params'>event_params</span> <span class='op'>=</span> <span class='id identifier rubyid_event_object'>event_object</span><span class='period'>.</span><span class='id identifier rubyid_riaction_event_params'>riaction_event_params</span>
209
+
210
+ <span class='kw'>if</span> <span class='lparen'>(</span> <span class='id identifier rubyid_klass_name'>klass_name</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span><span class='period'>.</span><span class='id identifier rubyid_riactionary?'>riactionary?</span> <span class='op'>&amp;&amp;</span>
211
+ <span class='id identifier rubyid_klass_name'>klass_name</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span><span class='period'>.</span><span class='id identifier rubyid_riaction_events?'>riaction_events?</span> <span class='op'>&amp;&amp;</span>
212
+ <span class='id identifier rubyid_klass_name'>klass_name</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span><span class='period'>.</span><span class='id identifier rubyid_riaction_defines_event?'>riaction_defines_event?</span><span class='lparen'>(</span><span class='id identifier rubyid_event_name_sym'>event_name_sym</span><span class='rparen'>)</span> <span class='rparen'>)</span>
213
+ <span class='id identifier rubyid_iactionable_api'>iactionable_api</span><span class='period'>.</span><span class='id identifier rubyid_log_event'>log_event</span><span class='lparen'>(</span> <span class='id identifier rubyid_event_params'>event_params</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name_sym'>event_name_sym</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:profile</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='comma'>,</span>
214
+ <span class='id identifier rubyid_event_params'>event_params</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name_sym'>event_name_sym</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:profile</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:id_type</span><span class='rbracket'>]</span><span class='comma'>,</span>
215
+ <span class='id identifier rubyid_event_params'>event_params</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name_sym'>event_name_sym</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:profile</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='comma'>,</span>
216
+ <span class='id identifier rubyid_event_name_sym'>event_name_sym</span><span class='comma'>,</span>
217
+ <span class='id identifier rubyid_event_params'>event_params</span><span class='lbracket'>[</span><span class='id identifier rubyid_event_name_sym'>event_name_sym</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:params</span><span class='rbracket'>]</span><span class='rparen'>)</span>
218
+ <span class='kw'>else</span>
219
+ <span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Riaction</span><span class='op'>::</span><span class='const'>ConfigurationError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_klass_name'>klass_name</span><span class='rbrace'>}</span><span class='tstring_content'> does not define event </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_event_name'>event_name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
220
+ <span class='kw'>end</span>
221
+ <span class='kw'>rescue</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>RecordNotFound</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
222
+ <span class='comment'># event_object no longer exists; no means to recover
223
+ </span><span class='kw'>rescue</span> <span class='const'>IActionable</span><span class='op'>::</span><span class='const'>Error</span><span class='op'>::</span><span class='const'>BadRequest</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
224
+ <span class='comment'># Log event should never throw this as of IActionable API v3
225
+ </span><span class='kw'>rescue</span> <span class='const'>IActionable</span><span class='op'>::</span><span class='const'>Error</span><span class='op'>::</span><span class='const'>Internal</span><span class='comma'>,</span> <span class='const'>Faraday</span><span class='op'>::</span><span class='const'>Error</span><span class='op'>::</span><span class='const'>TimeoutError</span><span class='comma'>,</span> <span class='const'>Timeout</span><span class='op'>::</span><span class='const'>Error</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
226
+ <span class='comment'># upon an intenal error from IActionable, retry some set number of times by requeueing the task through Resque
227
+ </span> <span class='comment'># after the max number of attempts, re-raise
228
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_attempt'>attempt</span> <span class='op'>&lt;</span> <span class='op'>::</span><span class='const'>Riaction</span><span class='op'>::</span><span class='const'>Constants</span><span class='period'>.</span><span class='id identifier rubyid_retry_attempts_for_internal_error'>retry_attempts_for_internal_error</span>
229
+ <span class='const'>Resque</span><span class='period'>.</span><span class='id identifier rubyid_enqueue'>enqueue</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_event_name'>event_name</span><span class='comma'>,</span> <span class='id identifier rubyid_klass_name'>klass_name</span><span class='comma'>,</span> <span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_attempt'>attempt</span><span class='op'>+</span><span class='int'>1</span><span class='rparen'>)</span>
230
+ <span class='kw'>else</span>
231
+ <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_e'>e</span>
232
+ <span class='kw'>end</span>
233
+ <span class='kw'>end</span></pre>
234
+ </td>
235
+ </tr>
236
+ </table>
237
+ </div>
238
+
239
+ </div>
240
+
241
+ </div>
242
+
243
+ <div id="footer">
244
+ Generated on Tue Mar 6 21:48:13 2012 by
245
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
246
+ 0.7.5 (ruby-1.9.3).
247
+ </div>
248
+
249
+ </body>
250
+ </html>