riaction 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardoc/checksums +11 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +12 -8
- data/README.md +6 -1
- data/db/riaction.db +0 -0
- data/doc/Riaction/ConfigurationError.html +116 -0
- data/doc/Riaction/Constants.html +389 -0
- data/doc/Riaction/CrudEventCallback.html +402 -0
- data/doc/Riaction/EventPerformer.html +250 -0
- data/doc/Riaction/NoEventDefined.html +116 -0
- data/doc/Riaction/NoProfileDefined.html +116 -0
- data/doc/Riaction/ProfileCreationCallback.html +192 -0
- data/doc/Riaction/ProfileCreator.html +235 -0
- data/doc/Riaction/Railtie.html +116 -0
- data/doc/Riaction/Riaction/ClassMethods.html +837 -0
- data/doc/Riaction/Riaction/Event/InstanceMethods.html +301 -0
- data/doc/Riaction/Riaction/Event.html +108 -0
- data/doc/Riaction/Riaction/InstanceMethods.html +198 -0
- data/doc/Riaction/Riaction/Profile/InstanceMethods.html +746 -0
- data/doc/Riaction/Riaction/Profile.html +108 -0
- data/doc/Riaction/Riaction.html +125 -0
- data/doc/Riaction/RuntimeError.html +116 -0
- data/doc/Riaction.html +124 -0
- data/doc/RiactionGenerator.html +188 -0
- data/doc/_index.html +263 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.README.html +304 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +304 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +294 -0
- data/doc/top-level-namespace.html +107 -0
- data/lib/riaction/constants.rb +6 -2
- data/lib/riaction/crud_event_callback.rb +3 -0
- data/lib/riaction/event_performer.rb +10 -5
- data/lib/riaction/profile_creation_callback.rb +2 -0
- data/lib/riaction/riaction.rb +11 -7
- data/lib/riaction/version.rb +1 -1
- data/lib/tasks/riaction.rake +25 -22
- data/riaction.gemspec +4 -2
- data/spec/event_performer_spec.rb +23 -0
- data/spec/riaction_spec.rb +33 -4
- metadata +79 -19
@@ -0,0 +1,294 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<base id="base_target" target="_parent" />
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<script type="text/javascript" charset="utf-8">
|
22
|
+
if (window.top.frames.main) {
|
23
|
+
document.getElementById('base_target').target = 'main';
|
24
|
+
document.body.className = 'frames';
|
25
|
+
}
|
26
|
+
</script>
|
27
|
+
<div id="content">
|
28
|
+
<h1 id="full_list_header">Method List</h1>
|
29
|
+
<div id="nav">
|
30
|
+
|
31
|
+
<a target="_self" href="class_list.html">Classes</a>
|
32
|
+
|
33
|
+
<a target="_self" href="method_list.html">Methods</a>
|
34
|
+
|
35
|
+
<a target="_self" href="file_list.html">Files</a>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
<div id="search">Search: <input type="text" /></div>
|
39
|
+
|
40
|
+
<ul id="full_list" class="methods">
|
41
|
+
|
42
|
+
|
43
|
+
<li class="r1 ">
|
44
|
+
<span class='object_link'><a href="Riaction/ProfileCreationCallback.html#after_create-instance_method" title="Riaction::ProfileCreationCallback#after_create (method)">#after_create</a></span>
|
45
|
+
|
46
|
+
<small>Riaction::ProfileCreationCallback</small>
|
47
|
+
|
48
|
+
</li>
|
49
|
+
|
50
|
+
|
51
|
+
<li class="r2 ">
|
52
|
+
<span class='object_link'><a href="Riaction/CrudEventCallback.html#after_create-instance_method" title="Riaction::CrudEventCallback#after_create (method)">#after_create</a></span>
|
53
|
+
|
54
|
+
<small>Riaction::CrudEventCallback</small>
|
55
|
+
|
56
|
+
</li>
|
57
|
+
|
58
|
+
|
59
|
+
<li class="r1 ">
|
60
|
+
<span class='object_link'><a href="Riaction/CrudEventCallback.html#after_destroy-instance_method" title="Riaction::CrudEventCallback#after_destroy (method)">#after_destroy</a></span>
|
61
|
+
|
62
|
+
<small>Riaction::CrudEventCallback</small>
|
63
|
+
|
64
|
+
</li>
|
65
|
+
|
66
|
+
|
67
|
+
<li class="r2 ">
|
68
|
+
<span class='object_link'><a href="Riaction/CrudEventCallback.html#after_update-instance_method" title="Riaction::CrudEventCallback#after_update (method)">#after_update</a></span>
|
69
|
+
|
70
|
+
<small>Riaction::CrudEventCallback</small>
|
71
|
+
|
72
|
+
</li>
|
73
|
+
|
74
|
+
|
75
|
+
<li class="r1 ">
|
76
|
+
<span class='object_link'><a href="RiactionGenerator.html#create_credentials_file-instance_method" title="RiactionGenerator#create_credentials_file (method)">#create_credentials_file</a></span>
|
77
|
+
|
78
|
+
<small>RiactionGenerator</small>
|
79
|
+
|
80
|
+
</li>
|
81
|
+
|
82
|
+
|
83
|
+
<li class="r2 ">
|
84
|
+
<span class='object_link'><a href="Riaction/Constants.html#crud_actions-class_method" title="Riaction::Constants.crud_actions (method)">crud_actions</a></span>
|
85
|
+
|
86
|
+
<small>Riaction::Constants</small>
|
87
|
+
|
88
|
+
</li>
|
89
|
+
|
90
|
+
|
91
|
+
<li class="r1 ">
|
92
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#establish_riactionary_class-instance_method" title="Riaction::Riaction::ClassMethods#establish_riactionary_class (method)">#establish_riactionary_class</a></span>
|
93
|
+
|
94
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
95
|
+
|
96
|
+
</li>
|
97
|
+
|
98
|
+
|
99
|
+
<li class="r2 ">
|
100
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#establish_riactionary_event_class-instance_method" title="Riaction::Riaction::ClassMethods#establish_riactionary_event_class (method)">#establish_riactionary_event_class</a></span>
|
101
|
+
|
102
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
103
|
+
|
104
|
+
</li>
|
105
|
+
|
106
|
+
|
107
|
+
<li class="r1 ">
|
108
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#establish_riactionary_profile_class-instance_method" title="Riaction::Riaction::ClassMethods#establish_riactionary_profile_class (method)">#establish_riactionary_profile_class</a></span>
|
109
|
+
|
110
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
111
|
+
|
112
|
+
</li>
|
113
|
+
|
114
|
+
|
115
|
+
<li class="r2 ">
|
116
|
+
<span class='object_link'><a href="Riaction/CrudEventCallback.html#initialize-instance_method" title="Riaction::CrudEventCallback#initialize (method)">#initialize</a></span>
|
117
|
+
|
118
|
+
<small>Riaction::CrudEventCallback</small>
|
119
|
+
|
120
|
+
</li>
|
121
|
+
|
122
|
+
|
123
|
+
<li class="r1 ">
|
124
|
+
<span class='object_link'><a href="Riaction/ProfileCreator.html#perform-class_method" title="Riaction::ProfileCreator.perform (method)">perform</a></span>
|
125
|
+
|
126
|
+
<small>Riaction::ProfileCreator</small>
|
127
|
+
|
128
|
+
</li>
|
129
|
+
|
130
|
+
|
131
|
+
<li class="r2 ">
|
132
|
+
<span class='object_link'><a href="Riaction/Constants.html#retry_attempts_for_internal_error-class_method" title="Riaction::Constants.retry_attempts_for_internal_error (method)">retry_attempts_for_internal_error</a></span>
|
133
|
+
|
134
|
+
<small>Riaction::Constants</small>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="r1 ">
|
140
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#riaction-instance_method" title="Riaction::Riaction::ClassMethods#riaction (method)">#riaction</a></span>
|
141
|
+
|
142
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
143
|
+
|
144
|
+
</li>
|
145
|
+
|
146
|
+
|
147
|
+
<li class="r2 ">
|
148
|
+
<span class='object_link'><a href="Riaction/Riaction/Event/InstanceMethods.html#riaction_event_params-instance_method" title="Riaction::Riaction::Event::InstanceMethods#riaction_event_params (method)">#riaction_event_params</a></span>
|
149
|
+
|
150
|
+
<small>Riaction::Riaction::Event::InstanceMethods</small>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="r1 ">
|
156
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#riaction_events%3F-instance_method" title="Riaction::Riaction::ClassMethods#riaction_events? (method)">#riaction_events?</a></span>
|
157
|
+
|
158
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
<li class="r2 ">
|
164
|
+
<span class='object_link'><a href="Riaction/Riaction/Event/InstanceMethods.html#riaction_log_event%3F-instance_method" title="Riaction::Riaction::Event::InstanceMethods#riaction_log_event? (method)">#riaction_log_event?</a></span>
|
165
|
+
|
166
|
+
<small>Riaction::Riaction::Event::InstanceMethods</small>
|
167
|
+
|
168
|
+
</li>
|
169
|
+
|
170
|
+
|
171
|
+
<li class="r1 ">
|
172
|
+
<span class='object_link'><a href="Riaction/Constants.html#riaction_options-class_method" title="Riaction::Constants.riaction_options (method)">riaction_options</a></span>
|
173
|
+
|
174
|
+
<small>Riaction::Constants</small>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
<li class="r2 ">
|
180
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#riaction_profile%3F-instance_method" title="Riaction::Riaction::ClassMethods#riaction_profile? (method)">#riaction_profile?</a></span>
|
181
|
+
|
182
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
<li class="r1 ">
|
188
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_achievements-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_achievements (method)">#riaction_profile_achievements</a></span>
|
189
|
+
|
190
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="r2 ">
|
196
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_challenges-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_challenges (method)">#riaction_profile_challenges</a></span>
|
197
|
+
|
198
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
<li class="r1 ">
|
204
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_display_name-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_display_name (method)">#riaction_profile_display_name</a></span>
|
205
|
+
|
206
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
207
|
+
|
208
|
+
</li>
|
209
|
+
|
210
|
+
|
211
|
+
<li class="r2 ">
|
212
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_goals-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_goals (method)">#riaction_profile_goals</a></span>
|
213
|
+
|
214
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
215
|
+
|
216
|
+
</li>
|
217
|
+
|
218
|
+
|
219
|
+
<li class="r1 ">
|
220
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_keys-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_keys (method)">#riaction_profile_keys</a></span>
|
221
|
+
|
222
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
223
|
+
|
224
|
+
</li>
|
225
|
+
|
226
|
+
|
227
|
+
<li class="r2 ">
|
228
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_notifications-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_notifications (method)">#riaction_profile_notifications</a></span>
|
229
|
+
|
230
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
231
|
+
|
232
|
+
</li>
|
233
|
+
|
234
|
+
|
235
|
+
<li class="r1 ">
|
236
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_points-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_points (method)">#riaction_profile_points</a></span>
|
237
|
+
|
238
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
239
|
+
|
240
|
+
</li>
|
241
|
+
|
242
|
+
|
243
|
+
<li class="r2 ">
|
244
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_profile_summary-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_profile_summary (method)">#riaction_profile_summary</a></span>
|
245
|
+
|
246
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
247
|
+
|
248
|
+
</li>
|
249
|
+
|
250
|
+
|
251
|
+
<li class="r1 ">
|
252
|
+
<span class='object_link'><a href="Riaction/Riaction/InstanceMethods.html#riaction_resolve_param-instance_method" title="Riaction::Riaction::InstanceMethods#riaction_resolve_param (method)">#riaction_resolve_param</a></span>
|
253
|
+
|
254
|
+
<small>Riaction::Riaction::InstanceMethods</small>
|
255
|
+
|
256
|
+
</li>
|
257
|
+
|
258
|
+
|
259
|
+
<li class="r2 ">
|
260
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_set_profile-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_set_profile (method)">#riaction_set_profile</a></span>
|
261
|
+
|
262
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
263
|
+
|
264
|
+
</li>
|
265
|
+
|
266
|
+
|
267
|
+
<li class="r1 ">
|
268
|
+
<span class='object_link'><a href="Riaction/Riaction/Profile/InstanceMethods.html#riaction_update_profile_points-instance_method" title="Riaction::Riaction::Profile::InstanceMethods#riaction_update_profile_points (method)">#riaction_update_profile_points</a></span>
|
269
|
+
|
270
|
+
<small>Riaction::Riaction::Profile::InstanceMethods</small>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
<li class="r2 ">
|
276
|
+
<span class='object_link'><a href="Riaction/Riaction/ClassMethods.html#riactionary%3F-instance_method" title="Riaction::Riaction::ClassMethods#riactionary? (method)">#riactionary?</a></span>
|
277
|
+
|
278
|
+
<small>Riaction::Riaction::ClassMethods</small>
|
279
|
+
|
280
|
+
</li>
|
281
|
+
|
282
|
+
|
283
|
+
<li class="r1 ">
|
284
|
+
<span class='object_link'><a href="Riaction/Constants.html#supported_identifier_types-class_method" title="Riaction::Constants.supported_identifier_types (method)">supported_identifier_types</a></span>
|
285
|
+
|
286
|
+
<small>Riaction::Constants</small>
|
287
|
+
|
288
|
+
</li>
|
289
|
+
|
290
|
+
|
291
|
+
</ul>
|
292
|
+
</div>
|
293
|
+
</body>
|
294
|
+
</html>
|
@@ -0,0 +1,107 @@
|
|
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
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— 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</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">Top Level Namespace</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>Top Level Namespace
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
</dl>
|
75
|
+
<div class="clear"></div>
|
76
|
+
|
77
|
+
<h2>Defined Under Namespace</h2>
|
78
|
+
<p class="children">
|
79
|
+
|
80
|
+
|
81
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Riaction.html" title="Riaction (module)">Riaction</a></span>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="RiactionGenerator.html" title="RiactionGenerator (class)">RiactionGenerator</a></span>
|
86
|
+
|
87
|
+
|
88
|
+
</p>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
<div id="footer">
|
101
|
+
Generated on Tue Mar 6 22:00:20 2012 by
|
102
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
103
|
+
0.7.5 (ruby-1.9.3).
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</body>
|
107
|
+
</html>
|
data/lib/riaction/constants.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
module Riaction
|
2
2
|
class Constants
|
3
|
+
# sets the default actions to be considered as part of riaction
|
3
4
|
def self.crud_actions
|
4
5
|
Set.new [:create, :update, :destroy]
|
5
6
|
end
|
6
|
-
|
7
|
+
|
8
|
+
# sets the default number of attempts to retry a action incase of an internal error
|
7
9
|
def self.retry_attempts_for_internal_error
|
8
10
|
3
|
9
11
|
end
|
10
|
-
|
12
|
+
|
13
|
+
# sets the valid supported identifiers
|
14
|
+
# @return returns an array of symbols
|
11
15
|
def self.supported_identifier_types
|
12
16
|
[:email,:username,:custom,:facebook,:twitter,:salesforce]
|
13
17
|
end
|
@@ -7,18 +7,21 @@ module Riaction
|
|
7
7
|
@event_name = event_name
|
8
8
|
end
|
9
9
|
|
10
|
+
# Enqueues a Riaction::EventPerformer object in resque after a model has been created
|
10
11
|
def after_create(record)
|
11
12
|
if record.riaction_log_event?(@event_name) && !record.class.riactionless?
|
12
13
|
Resque.enqueue(::Riaction::EventPerformer, @event_name, record.class.base_class.to_s, record.id)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
17
|
+
# Enqueues a Riaction::EventPerformer object in resque after a model has been updated
|
16
18
|
def after_update(record)
|
17
19
|
if record.riaction_log_event?(@event_name) && !record.class.riactionless?
|
18
20
|
Resque.enqueue(::Riaction::EventPerformer, @event_name, record.class.base_class.to_s, record.id)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
24
|
+
# Enqueues a Riaction::EventPerformer object in resque after a model has been destroyed
|
22
25
|
def after_destroy(record)
|
23
26
|
if record.riaction_log_event?(@event_name) && !record.class.riactionless?
|
24
27
|
Resque.enqueue(::Riaction::EventPerformer, @event_name, record.class.base_class.to_s, record.id)
|
@@ -5,6 +5,7 @@ module Riaction
|
|
5
5
|
class EventPerformer
|
6
6
|
@queue = :riaction_event_logger
|
7
7
|
|
8
|
+
# Sends an event to IActionable based on the name of a riaction class and the ID used to locate the instance
|
8
9
|
def self.perform(event_name, klass_name, id, attempt=0)
|
9
10
|
event_name_sym = event_name.to_sym
|
10
11
|
iactionable_api = IActionable::Api.new
|
@@ -14,11 +15,15 @@ module Riaction
|
|
14
15
|
if ( klass_name.constantize.riactionary? &&
|
15
16
|
klass_name.constantize.riaction_events? &&
|
16
17
|
klass_name.constantize.riaction_defines_event?(event_name_sym) )
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
if event_params.has_key?(event_name_sym)
|
19
|
+
iactionable_api.log_event( event_params[event_name_sym][:profile][:type],
|
20
|
+
event_params[event_name_sym][:profile][:id_type],
|
21
|
+
event_params[event_name_sym][:profile][:id],
|
22
|
+
event_name_sym,
|
23
|
+
event_params[event_name_sym][:params])
|
24
|
+
else
|
25
|
+
raise ::Riaction::ConfigurationError.new("Instance of #{klass_name} with ID #{id} could not construct event parameters for event #{event_name}. Is the profile a valid one?")
|
26
|
+
end
|
22
27
|
else
|
23
28
|
raise ::Riaction::ConfigurationError.new("#{klass_name} does not define event #{event_name}")
|
24
29
|
end
|
@@ -3,6 +3,8 @@ require 'riaction/profile_creator'
|
|
3
3
|
|
4
4
|
module Riaction
|
5
5
|
class ProfileCreationCallback
|
6
|
+
|
7
|
+
# Enqueue a Riaction::ProfileCreatore object in resque
|
6
8
|
def after_create(record)
|
7
9
|
Resque.enqueue(::Riaction::ProfileCreator, record.class.base_class.to_s, record.id) unless record.class.riactionless?
|
8
10
|
end
|
data/lib/riaction/riaction.rb
CHANGED
@@ -38,8 +38,11 @@ module Riaction
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
# Patches a class to turn it into a riactionary class, providing some default checks and attributes
|
41
42
|
def establish_riactionary_class
|
42
43
|
class << self
|
44
|
+
|
45
|
+
# returns true if a class has riaction setup
|
43
46
|
def riactionary?
|
44
47
|
true
|
45
48
|
end
|
@@ -327,14 +330,15 @@ module Riaction
|
|
327
330
|
def riaction_event_params
|
328
331
|
resolved_hash = {}
|
329
332
|
self.class.riaction_events.each_pair do |event_name, args|
|
330
|
-
resolved_hash[event_name] = {}
|
331
333
|
resolved_profile = riaction_resolve_param(args[:profile])
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
334
|
+
if resolved_profile.nil? ||
|
335
|
+
!resolved_profile.kind_of?(ActiveRecord::Base) ||
|
336
|
+
!resolved_profile.class.riactionary? ||
|
337
|
+
!resolved_profile.class.riaction_profile? ||
|
338
|
+
resolved_profile.class.riaction_profile_types_defined == 0
|
339
|
+
next
|
340
|
+
else
|
341
|
+
resolved_hash[event_name] = {}
|
338
342
|
end
|
339
343
|
profile_keys = resolved_profile.riaction_profile_keys
|
340
344
|
unless args[:profile_type].nil?
|
data/lib/riaction/version.rb
CHANGED
data/lib/tasks/riaction.rake
CHANGED
@@ -111,34 +111,37 @@ namespace 'riaction' do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
desc "Process a specified event on a specified class (requires EVENT_CLASS and EVENT_NAME)"
|
114
|
-
task :event => :environment do
|
115
|
-
klass_name =
|
116
|
-
event_symbol =
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
114
|
+
task :event, :klass_name, :event_symbol, :needs => :environment do |t, args|
|
115
|
+
klass_name = args.klass_name
|
116
|
+
event_symbol = args.event_symbol.to_sym rescue nil
|
117
|
+
if klass_name.nil? || event_symbol.nil?
|
118
|
+
puts "provide [Class, event name] as arguments to this rake task"
|
119
|
+
else
|
120
|
+
begin
|
121
|
+
if klass_name.constantize.riaction_events.has_key? event_symbol
|
122
|
+
klass_name.constantize.all.each do |record|
|
123
|
+
if record.riaction_log_event? event_symbol
|
124
|
+
profile_params = record.riaction_event_params[event_symbol][:profile]
|
125
|
+
event_params = record.riaction_event_params[event_symbol][:params].stringify_keys
|
123
126
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
127
|
+
IActionable::Api.new.log_event( profile_params[:type].to_s,
|
128
|
+
profile_params[:id_type].to_s,
|
129
|
+
profile_params[:id].to_s,
|
130
|
+
event_symbol.to_s,
|
131
|
+
event_params )
|
132
|
+
puts "Logged #{event_symbol} for #{record.id}"
|
133
|
+
else
|
134
|
+
puts "Event could not be logged for id:#{record.id}"
|
135
|
+
end
|
132
136
|
end
|
137
|
+
else
|
138
|
+
puts "'#{event_symbol}' is not a valid event"
|
133
139
|
end
|
134
|
-
|
135
|
-
puts
|
140
|
+
rescue NameError => e
|
141
|
+
puts e
|
136
142
|
end
|
137
|
-
rescue NameError => e
|
138
|
-
puts e
|
139
143
|
end
|
140
144
|
end
|
141
|
-
|
142
145
|
end
|
143
146
|
end
|
144
147
|
end
|
data/riaction.gemspec
CHANGED
@@ -5,9 +5,9 @@ require "riaction/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "riaction"
|
7
7
|
s.version = Riaction::VERSION
|
8
|
-
s.authors = ["Chris Eberz"]
|
8
|
+
s.authors = ["Chris Eberz", "Katie Miller", "Nicholas Audo"]
|
9
9
|
s.email = ["ceberz@elctech.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/zortnac/riaction/"
|
11
11
|
s.summary = %q{Wrapper for IActionable's restful API and an "acts-as" style interface for models to behave as profiles and drive game events.}
|
12
12
|
s.description = %q{Wrapper for IActionable's restful API and an "acts-as" style interface for models to behave as profiles and drive game events.}
|
13
13
|
|
@@ -22,6 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "rspec", ">= 2.8"
|
23
23
|
s.add_development_dependency "sqlite3"
|
24
24
|
s.add_development_dependency "ruby-debug19"
|
25
|
+
s.add_development_dependency "yard"
|
26
|
+
s.add_development_dependency "redcarpet"
|
25
27
|
|
26
28
|
s.add_runtime_dependency "rake"
|
27
29
|
s.add_runtime_dependency "activerecord", ">= 3.0.0"
|
@@ -187,6 +187,29 @@ describe "sending an event to IActionable from the name of a riaction class and
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
+
describe "when an event that the class defines is missing from the instance (due here to an invalid profile)" do
|
191
|
+
before do
|
192
|
+
Comment.class_eval do
|
193
|
+
riaction :event, :name => :make_a_comment, :trigger => :create, :profile => :user, :profile_type => :npc, :params => {:foo => 'bar'}
|
194
|
+
end
|
195
|
+
|
196
|
+
# creating the comment wihtout a user will lead to a missing profile for the event
|
197
|
+
@comment = Comment.riactionless{ Comment.create(:content => 'this is a comment') }
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should not try to create the event" do
|
201
|
+
@api.should_not_receive(:log_event)
|
202
|
+
begin
|
203
|
+
::Riaction::EventPerformer.perform(:make_a_comment, 'Comment', @comment.id)
|
204
|
+
rescue Exception => e
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should raise a ConfigurationError" do
|
209
|
+
lambda { ::Riaction::EventPerformer.perform(:make_a_comment, 'Comment', @comment.id) }.should raise_error(::Riaction::ConfigurationError)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
190
213
|
describe "when the object specified is missing" do
|
191
214
|
before do
|
192
215
|
Comment.class_eval do
|