servus 0.1.3 → 0.1.5

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/check-docs.md +1 -0
  3. data/.claude/commands/consistency-check.md +1 -0
  4. data/.claude/commands/fine-tooth-comb.md +1 -0
  5. data/.claude/commands/red-green-refactor.md +5 -0
  6. data/.claude/settings.json +15 -0
  7. data/.rubocop.yml +18 -2
  8. data/.yardopts +6 -0
  9. data/CHANGELOG.md +47 -0
  10. data/CLAUDE.md +10 -0
  11. data/IDEAS.md +5 -0
  12. data/READme.md +300 -47
  13. data/Rakefile +33 -0
  14. data/builds/servus-0.1.3.gem +0 -0
  15. data/builds/servus-0.1.4.gem +0 -0
  16. data/builds/servus-0.1.5.gem +0 -0
  17. data/docs/core/1_overview.md +77 -0
  18. data/docs/core/2_architecture.md +120 -0
  19. data/docs/core/3_service_objects.md +121 -0
  20. data/docs/current_focus.md +569 -0
  21. data/docs/features/1_schema_validation.md +119 -0
  22. data/docs/features/2_error_handling.md +121 -0
  23. data/docs/features/3_async_execution.md +81 -0
  24. data/docs/features/4_logging.md +64 -0
  25. data/docs/features/5_event_bus.md +244 -0
  26. data/docs/guides/1_common_patterns.md +90 -0
  27. data/docs/guides/2_migration_guide.md +175 -0
  28. data/docs/integration/1_configuration.md +104 -0
  29. data/docs/integration/2_testing.md +287 -0
  30. data/docs/integration/3_rails_integration.md +99 -0
  31. data/docs/yard/Servus/Base.html +1645 -0
  32. data/docs/yard/Servus/Config.html +582 -0
  33. data/docs/yard/Servus/Extensions/Async/Call.html +400 -0
  34. data/docs/yard/Servus/Extensions/Async/Errors/AsyncError.html +140 -0
  35. data/docs/yard/Servus/Extensions/Async/Errors/JobEnqueueError.html +154 -0
  36. data/docs/yard/Servus/Extensions/Async/Errors/ServiceNotFoundError.html +154 -0
  37. data/docs/yard/Servus/Extensions/Async/Errors.html +128 -0
  38. data/docs/yard/Servus/Extensions/Async/Ext.html +119 -0
  39. data/docs/yard/Servus/Extensions/Async/Job.html +310 -0
  40. data/docs/yard/Servus/Extensions/Async.html +141 -0
  41. data/docs/yard/Servus/Extensions.html +117 -0
  42. data/docs/yard/Servus/Generators/ServiceGenerator.html +261 -0
  43. data/docs/yard/Servus/Generators.html +115 -0
  44. data/docs/yard/Servus/Helpers/ControllerHelpers.html +457 -0
  45. data/docs/yard/Servus/Helpers.html +115 -0
  46. data/docs/yard/Servus/Railtie.html +134 -0
  47. data/docs/yard/Servus/Support/Errors/AuthenticationError.html +287 -0
  48. data/docs/yard/Servus/Support/Errors/BadRequestError.html +283 -0
  49. data/docs/yard/Servus/Support/Errors/ForbiddenError.html +284 -0
  50. data/docs/yard/Servus/Support/Errors/InternalServerError.html +283 -0
  51. data/docs/yard/Servus/Support/Errors/NotFoundError.html +284 -0
  52. data/docs/yard/Servus/Support/Errors/ServiceError.html +489 -0
  53. data/docs/yard/Servus/Support/Errors/ServiceUnavailableError.html +290 -0
  54. data/docs/yard/Servus/Support/Errors/UnauthorizedError.html +200 -0
  55. data/docs/yard/Servus/Support/Errors/UnprocessableEntityError.html +288 -0
  56. data/docs/yard/Servus/Support/Errors/ValidationError.html +200 -0
  57. data/docs/yard/Servus/Support/Errors.html +140 -0
  58. data/docs/yard/Servus/Support/Logger.html +856 -0
  59. data/docs/yard/Servus/Support/Rescuer/BlockContext.html +585 -0
  60. data/docs/yard/Servus/Support/Rescuer/CallOverride.html +257 -0
  61. data/docs/yard/Servus/Support/Rescuer/ClassMethods.html +343 -0
  62. data/docs/yard/Servus/Support/Rescuer.html +267 -0
  63. data/docs/yard/Servus/Support/Response.html +574 -0
  64. data/docs/yard/Servus/Support/Validator.html +1150 -0
  65. data/docs/yard/Servus/Support.html +119 -0
  66. data/docs/yard/Servus/Testing/ExampleBuilders.html +523 -0
  67. data/docs/yard/Servus/Testing/ExampleExtractor.html +578 -0
  68. data/docs/yard/Servus/Testing.html +142 -0
  69. data/docs/yard/Servus.html +343 -0
  70. data/docs/yard/_index.html +535 -0
  71. data/docs/yard/class_list.html +54 -0
  72. data/docs/yard/css/common.css +1 -0
  73. data/docs/yard/css/full_list.css +58 -0
  74. data/docs/yard/css/style.css +503 -0
  75. data/docs/yard/file.1_common_patterns.html +154 -0
  76. data/docs/yard/file.1_configuration.html +115 -0
  77. data/docs/yard/file.1_overview.html +142 -0
  78. data/docs/yard/file.1_schema_validation.html +188 -0
  79. data/docs/yard/file.2_architecture.html +157 -0
  80. data/docs/yard/file.2_error_handling.html +190 -0
  81. data/docs/yard/file.2_migration_guide.html +242 -0
  82. data/docs/yard/file.2_testing.html +227 -0
  83. data/docs/yard/file.3_async_execution.html +145 -0
  84. data/docs/yard/file.3_rails_integration.html +160 -0
  85. data/docs/yard/file.3_service_objects.html +191 -0
  86. data/docs/yard/file.4_logging.html +135 -0
  87. data/docs/yard/file.ErrorHandling.html +190 -0
  88. data/docs/yard/file.READme.html +674 -0
  89. data/docs/yard/file.architecture.html +157 -0
  90. data/docs/yard/file.async_execution.html +145 -0
  91. data/docs/yard/file.common_patterns.html +154 -0
  92. data/docs/yard/file.configuration.html +115 -0
  93. data/docs/yard/file.error_handling.html +190 -0
  94. data/docs/yard/file.logging.html +135 -0
  95. data/docs/yard/file.migration_guide.html +242 -0
  96. data/docs/yard/file.overview.html +142 -0
  97. data/docs/yard/file.rails_integration.html +160 -0
  98. data/docs/yard/file.schema_validation.html +188 -0
  99. data/docs/yard/file.service_objects.html +191 -0
  100. data/docs/yard/file.testing.html +227 -0
  101. data/docs/yard/file_list.html +119 -0
  102. data/docs/yard/frames.html +22 -0
  103. data/docs/yard/index.html +674 -0
  104. data/docs/yard/js/app.js +344 -0
  105. data/docs/yard/js/full_list.js +242 -0
  106. data/docs/yard/js/jquery.js +4 -0
  107. data/docs/yard/method_list.html +542 -0
  108. data/docs/yard/top-level-namespace.html +110 -0
  109. data/lib/generators/servus/event_handler/event_handler_generator.rb +59 -0
  110. data/lib/generators/servus/event_handler/templates/handler.rb.erb +86 -0
  111. data/lib/generators/servus/event_handler/templates/handler_spec.rb.erb +48 -0
  112. data/lib/generators/servus/service/service_generator.rb +68 -1
  113. data/lib/generators/servus/service/templates/arguments.json.erb +19 -10
  114. data/lib/generators/servus/service/templates/result.json.erb +8 -2
  115. data/lib/generators/servus/service/templates/service.rb.erb +102 -5
  116. data/lib/generators/servus/service/templates/service_spec.rb.erb +67 -6
  117. data/lib/servus/base.rb +275 -58
  118. data/lib/servus/config.rb +83 -17
  119. data/lib/servus/event_handler.rb +275 -0
  120. data/lib/servus/events/bus.rb +137 -0
  121. data/lib/servus/events/emitter.rb +162 -0
  122. data/lib/servus/events/errors.rb +10 -0
  123. data/lib/servus/extensions/async/call.rb +50 -18
  124. data/lib/servus/extensions/async/errors.rb +23 -3
  125. data/lib/servus/extensions/async/ext.rb +10 -2
  126. data/lib/servus/extensions/async/job.rb +30 -9
  127. data/lib/servus/helpers/controller_helpers.rb +73 -37
  128. data/lib/servus/railtie.rb +16 -0
  129. data/lib/servus/support/errors.rb +135 -45
  130. data/lib/servus/support/rescuer.rb +189 -36
  131. data/lib/servus/support/response.rb +49 -7
  132. data/lib/servus/support/validator.rb +147 -19
  133. data/lib/servus/testing/example_builders.rb +133 -0
  134. data/lib/servus/testing/example_extractor.rb +309 -0
  135. data/lib/servus/testing/matchers.rb +88 -0
  136. data/lib/servus/testing.rb +19 -0
  137. data/lib/servus/version.rb +1 -1
  138. data/lib/servus.rb +6 -0
  139. metadata +135 -19
@@ -0,0 +1,585 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Servus::Support::Rescuer::BlockContext
8
+
9
+ &mdash; Servus | Service Object Framework
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Servus::Support::Rescuer::BlockContext";
19
+ relpath = '../../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../../_index.html">Index (B)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../../Servus.html" title="Servus (module)">Servus</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Support.html" title="Servus::Support (module)">Support</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Rescuer.html" title="Servus::Support::Rescuer (module)">Rescuer</a></span></span>
41
+ &raquo;
42
+ <span class="title">BlockContext</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Servus::Support::Rescuer::BlockContext
63
+
64
+
65
+ <span class="private note title">Private</span>
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Servus::Support::Rescuer::BlockContext</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/servus/support/rescuer.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p class="note private">
105
+ <strong>This class is part of a private API.</strong>
106
+ You should avoid using this class if possible, as it may be removed or be changed in the future.
107
+ </p>
108
+ <p>Provides success/failure methods to rescue_from blocks.</p>
109
+
110
+ <p>This context is used when a rescue_from block is executed. It provides
111
+ the same success() and failure() methods available in service call methods,
112
+ allowing blocks to create appropriate Response objects.</p>
113
+
114
+
115
+ </div>
116
+ </div>
117
+ <div class="tags">
118
+
119
+
120
+ </div>
121
+
122
+
123
+
124
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
125
+ <ul class="summary">
126
+
127
+ <li class="public ">
128
+ <span class="summary_signature">
129
+
130
+ <a href="#result-instance_method" title="#result (instance method)">#<strong>result</strong> &#x21d2; Servus::Support::Response<sup>?</sup> </a>
131
+
132
+
133
+
134
+ </span>
135
+
136
+
137
+
138
+
139
+ <span class="note title readonly">readonly</span>
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="private note title">private</span>
147
+
148
+
149
+ <span class="summary_desc"><div class='inline'><p>The response created by success() or failure().</p>
150
+ </div></span>
151
+
152
+ </li>
153
+
154
+
155
+ </ul>
156
+
157
+
158
+
159
+
160
+
161
+ <h2>
162
+ Instance Method Summary
163
+ <small><a href="#" class="summary_toggle">collapse</a></small>
164
+ </h2>
165
+
166
+ <ul class="summary">
167
+
168
+ <li class="public ">
169
+ <span class="summary_signature">
170
+
171
+ <a href="#failure-instance_method" title="#failure (instance method)">#<strong>failure</strong>(message = nil, type: Servus::Support::Errors::ServiceError) &#x21d2; Servus::Support::Response </a>
172
+
173
+
174
+
175
+ </span>
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <span class="private note title">private</span>
183
+
184
+
185
+ <span class="summary_desc"><div class='inline'><p>Creates a failure response.</p>
186
+ </div></span>
187
+
188
+ </li>
189
+
190
+
191
+ <li class="public ">
192
+ <span class="summary_signature">
193
+
194
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; BlockContext </a>
195
+
196
+
197
+
198
+ </span>
199
+
200
+
201
+ <span class="note title constructor">constructor</span>
202
+
203
+
204
+
205
+
206
+
207
+ <span class="private note title">private</span>
208
+
209
+
210
+ <span class="summary_desc"><div class='inline'><p>A new instance of BlockContext.</p>
211
+ </div></span>
212
+
213
+ </li>
214
+
215
+
216
+ <li class="public ">
217
+ <span class="summary_signature">
218
+
219
+ <a href="#success-instance_method" title="#success (instance method)">#<strong>success</strong>(data = nil) &#x21d2; Servus::Support::Response </a>
220
+
221
+
222
+
223
+ </span>
224
+
225
+
226
+
227
+
228
+
229
+
230
+ <span class="private note title">private</span>
231
+
232
+
233
+ <span class="summary_desc"><div class='inline'><p>Creates a success response.</p>
234
+ </div></span>
235
+
236
+ </li>
237
+
238
+
239
+ </ul>
240
+
241
+
242
+ <div id="constructor_details" class="method_details_list">
243
+ <h2>Constructor Details</h2>
244
+
245
+ <div class="method_details first">
246
+ <h3 class="signature first" id="initialize-instance_method">
247
+
248
+ #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Servus::Support::Rescuer::BlockContext (class)">BlockContext</a></span></tt>
249
+
250
+
251
+
252
+
253
+
254
+ </h3><div class="docstring">
255
+ <div class="discussion">
256
+ <p class="note private">
257
+ <strong>This method is part of a private API.</strong>
258
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
259
+ </p>
260
+ <p>Returns a new instance of BlockContext.</p>
261
+
262
+
263
+ </div>
264
+ </div>
265
+ <div class="tags">
266
+
267
+
268
+ </div><table class="source_code">
269
+ <tr>
270
+ <td>
271
+ <pre class="lines">
272
+
273
+
274
+ 40
275
+ 41
276
+ 42</pre>
277
+ </td>
278
+ <td>
279
+ <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 40</span>
280
+
281
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
282
+ <span class='ivar'>@result</span> <span class='op'>=</span> <span class='kw'>nil</span>
283
+ <span class='kw'>end</span></pre>
284
+ </td>
285
+ </tr>
286
+ </table>
287
+ </div>
288
+
289
+ </div>
290
+
291
+ <div id="instance_attr_details" class="attr_details">
292
+ <h2>Instance Attribute Details</h2>
293
+
294
+
295
+ <span id=""></span>
296
+ <div class="method_details first">
297
+ <h3 class="signature first" id="result-instance_method">
298
+
299
+ #<strong>result</strong> &#x21d2; <tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt><sup>?</sup> <span class="extras">(readonly)</span>
300
+
301
+
302
+
303
+
304
+
305
+ </h3><div class="docstring">
306
+ <div class="discussion">
307
+ <p class="note private">
308
+ <strong>This method is part of a private API.</strong>
309
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
310
+ </p>
311
+ <p>The response created by success() or failure().</p>
312
+
313
+
314
+ </div>
315
+ </div>
316
+ <div class="tags">
317
+
318
+ <p class="tag_title">Returns:</p>
319
+ <ul class="return">
320
+
321
+ <li>
322
+
323
+
324
+ <span class='type'>(<tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>, <tt>nil</tt>)</span>
325
+
326
+
327
+
328
+ &mdash;
329
+ <div class='inline'><p>The response, or nil if neither method was called</p>
330
+ </div>
331
+
332
+ </li>
333
+
334
+ </ul>
335
+
336
+ </div><table class="source_code">
337
+ <tr>
338
+ <td>
339
+ <pre class="lines">
340
+
341
+
342
+ 82
343
+ 83
344
+ 84</pre>
345
+ </td>
346
+ <td>
347
+ <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 82</span>
348
+
349
+ <span class='kw'>def</span> <span class='id identifier rubyid_result'>result</span>
350
+ <span class='ivar'>@result</span>
351
+ <span class='kw'>end</span></pre>
352
+ </td>
353
+ </tr>
354
+ </table>
355
+ </div>
356
+
357
+ </div>
358
+
359
+
360
+ <div id="instance_method_details" class="method_details_list">
361
+ <h2>Instance Method Details</h2>
362
+
363
+
364
+ <div class="method_details first">
365
+ <h3 class="signature first" id="failure-instance_method">
366
+
367
+ #<strong>failure</strong>(message = nil, type: Servus::Support::Errors::ServiceError) &#x21d2; <tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>
368
+
369
+
370
+
371
+
372
+
373
+ </h3><div class="docstring">
374
+ <div class="discussion">
375
+ <p class="note private">
376
+ <strong>This method is part of a private API.</strong>
377
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
378
+ </p>
379
+ <p>Creates a failure response.</p>
380
+
381
+ <p>Use this in rescue_from blocks to convert exceptions into business failures
382
+ with custom messages and error types.</p>
383
+
384
+
385
+ </div>
386
+ </div>
387
+ <div class="tags">
388
+
389
+ <div class="examples">
390
+ <h4 class="tag_title">Examples:</h4>
391
+
392
+
393
+ <pre class="example code"><code><span class='id identifier rubyid_rescue_from'>rescue_from</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>RecordInvalid</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_exception'>exception</span><span class='op'>|</span>
394
+ <span class='id identifier rubyid_failure'>failure</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Database error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>type:</span> <span class='const'>InternalServerError</span><span class='rparen'>)</span>
395
+ <span class='kw'>end</span></code></pre>
396
+
397
+ </div>
398
+ <p class="tag_title">Parameters:</p>
399
+ <ul class="param">
400
+
401
+ <li>
402
+
403
+ <span class='name'>message</span>
404
+
405
+
406
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
407
+
408
+
409
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
410
+
411
+
412
+ &mdash;
413
+ <div class='inline'><p>The error message (uses error type&#39;s DEFAULT_MESSAGE if nil)</p>
414
+ </div>
415
+
416
+ </li>
417
+
418
+ <li>
419
+
420
+ <span class='name'>type</span>
421
+
422
+
423
+ <span class='type'>(<tt>Class&lt;<span class='object_link'><a href="../Errors/ServiceError.html" title="Servus::Support::Errors::ServiceError (class)">Servus::Support::Errors::ServiceError</a></span>&gt;</tt>)</span>
424
+
425
+
426
+ <em class="default">(defaults to: <tt>Servus::Support::Errors::ServiceError</tt>)</em>
427
+
428
+
429
+ &mdash;
430
+ <div class='inline'><p>The error type</p>
431
+ </div>
432
+
433
+ </li>
434
+
435
+ </ul>
436
+
437
+ <p class="tag_title">Returns:</p>
438
+ <ul class="return">
439
+
440
+ <li>
441
+
442
+
443
+ <span class='type'>(<tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>)</span>
444
+
445
+
446
+
447
+ &mdash;
448
+ <div class='inline'><p>Failure response</p>
449
+ </div>
450
+
451
+ </li>
452
+
453
+ </ul>
454
+
455
+ </div><table class="source_code">
456
+ <tr>
457
+ <td>
458
+ <pre class="lines">
459
+
460
+
461
+ 73
462
+ 74
463
+ 75
464
+ 76</pre>
465
+ </td>
466
+ <td>
467
+ <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 73</span>
468
+
469
+ <span class='kw'>def</span> <span class='id identifier rubyid_failure'>failure</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>type:</span> <span class='const'><span class='object_link'><a href="../../../Servus.html" title="Servus (module)">Servus</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Support.html" title="Servus::Support (module)">Support</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors.html" title="Servus::Support::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors/ServiceError.html" title="Servus::Support::Errors::ServiceError (class)">ServiceError</a></span></span><span class='rparen'>)</span>
470
+ <span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
471
+ <span class='ivar'>@result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Response</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Response.html#initialize-instance_method" title="Servus::Support::Response#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
472
+ <span class='kw'>end</span></pre>
473
+ </td>
474
+ </tr>
475
+ </table>
476
+ </div>
477
+
478
+ <div class="method_details ">
479
+ <h3 class="signature " id="success-instance_method">
480
+
481
+ #<strong>success</strong>(data = nil) &#x21d2; <tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>
482
+
483
+
484
+
485
+
486
+
487
+ </h3><div class="docstring">
488
+ <div class="discussion">
489
+ <p class="note private">
490
+ <strong>This method is part of a private API.</strong>
491
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
492
+ </p>
493
+ <p>Creates a success response.</p>
494
+
495
+ <p>Use this in rescue_from blocks to recover from exceptions and return
496
+ successful results despite the error being raised.</p>
497
+
498
+
499
+ </div>
500
+ </div>
501
+ <div class="tags">
502
+
503
+ <div class="examples">
504
+ <h4 class="tag_title">Examples:</h4>
505
+
506
+
507
+ <pre class="example code"><code><span class='id identifier rubyid_rescue_from'>rescue_from</span> <span class='const'>SomeError</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_exception'>exception</span><span class='op'>|</span>
508
+ <span class='id identifier rubyid_success'>success</span><span class='lparen'>(</span><span class='label'>recovered:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>original_error:</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
509
+ <span class='kw'>end</span></code></pre>
510
+
511
+ </div>
512
+ <p class="tag_title">Parameters:</p>
513
+ <ul class="param">
514
+
515
+ <li>
516
+
517
+ <span class='name'>data</span>
518
+
519
+
520
+ <span class='type'>(<tt>Hash</tt>, <tt>Object</tt>)</span>
521
+
522
+
523
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
524
+
525
+
526
+ &mdash;
527
+ <div class='inline'><p>The success data to return</p>
528
+ </div>
529
+
530
+ </li>
531
+
532
+ </ul>
533
+
534
+ <p class="tag_title">Returns:</p>
535
+ <ul class="return">
536
+
537
+ <li>
538
+
539
+
540
+ <span class='type'>(<tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>)</span>
541
+
542
+
543
+
544
+ &mdash;
545
+ <div class='inline'><p>Success response</p>
546
+ </div>
547
+
548
+ </li>
549
+
550
+ </ul>
551
+
552
+ </div><table class="source_code">
553
+ <tr>
554
+ <td>
555
+ <pre class="lines">
556
+
557
+
558
+ 56
559
+ 57
560
+ 58</pre>
561
+ </td>
562
+ <td>
563
+ <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 56</span>
564
+
565
+ <span class='kw'>def</span> <span class='id identifier rubyid_success'>success</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
566
+ <span class='ivar'>@result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Response</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Response.html#initialize-instance_method" title="Servus::Support::Response#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
567
+ <span class='kw'>end</span></pre>
568
+ </td>
569
+ </tr>
570
+ </table>
571
+ </div>
572
+
573
+ </div>
574
+
575
+ </div>
576
+
577
+ <div id="footer">
578
+ Generated on Fri Nov 21 00:33:24 2025 by
579
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
580
+ 0.9.37 (ruby-3.4.4).
581
+ </div>
582
+
583
+ </div>
584
+ </body>
585
+ </html>