jsonapi_compliable 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +11 -3
  4. data/.yardopts +1 -0
  5. data/README.md +10 -1
  6. data/Rakefile +1 -0
  7. data/docs/JsonapiCompliable.html +202 -0
  8. data/docs/JsonapiCompliable/Adapters.html +119 -0
  9. data/docs/JsonapiCompliable/Adapters/Abstract.html +2285 -0
  10. data/docs/JsonapiCompliable/Adapters/ActiveRecord.html +2151 -0
  11. data/docs/JsonapiCompliable/Adapters/ActiveRecordSideloading.html +582 -0
  12. data/docs/JsonapiCompliable/Adapters/Null.html +1682 -0
  13. data/docs/JsonapiCompliable/Base.html +1395 -0
  14. data/docs/JsonapiCompliable/Deserializer.html +835 -0
  15. data/docs/JsonapiCompliable/Errors.html +115 -0
  16. data/docs/JsonapiCompliable/Errors/BadFilter.html +124 -0
  17. data/docs/JsonapiCompliable/Errors/StatNotFound.html +266 -0
  18. data/docs/JsonapiCompliable/Errors/UnsupportedPageSize.html +264 -0
  19. data/docs/JsonapiCompliable/Errors/ValidationError.html +124 -0
  20. data/docs/JsonapiCompliable/Extensions.html +117 -0
  21. data/docs/JsonapiCompliable/Extensions/BooleanAttribute.html +212 -0
  22. data/docs/JsonapiCompliable/Extensions/BooleanAttribute/ClassMethods.html +229 -0
  23. data/docs/JsonapiCompliable/Extensions/ExtraAttribute.html +242 -0
  24. data/docs/JsonapiCompliable/Extensions/ExtraAttribute/ClassMethods.html +237 -0
  25. data/docs/JsonapiCompliable/Query.html +1099 -0
  26. data/docs/JsonapiCompliable/Rails.html +211 -0
  27. data/docs/JsonapiCompliable/Resource.html +5241 -0
  28. data/docs/JsonapiCompliable/Scope.html +703 -0
  29. data/docs/JsonapiCompliable/Scoping.html +117 -0
  30. data/docs/JsonapiCompliable/Scoping/Base.html +843 -0
  31. data/docs/JsonapiCompliable/Scoping/DefaultFilter.html +318 -0
  32. data/docs/JsonapiCompliable/Scoping/ExtraFields.html +301 -0
  33. data/docs/JsonapiCompliable/Scoping/Filter.html +313 -0
  34. data/docs/JsonapiCompliable/Scoping/Filterable.html +364 -0
  35. data/docs/JsonapiCompliable/Scoping/Paginate.html +613 -0
  36. data/docs/JsonapiCompliable/Scoping/Sort.html +454 -0
  37. data/docs/JsonapiCompliable/SerializableTempId.html +216 -0
  38. data/docs/JsonapiCompliable/Sideload.html +2484 -0
  39. data/docs/JsonapiCompliable/Stats.html +117 -0
  40. data/docs/JsonapiCompliable/Stats/DSL.html +999 -0
  41. data/docs/JsonapiCompliable/Stats/Payload.html +391 -0
  42. data/docs/JsonapiCompliable/Util.html +117 -0
  43. data/docs/JsonapiCompliable/Util/FieldParams.html +228 -0
  44. data/docs/JsonapiCompliable/Util/Hash.html +471 -0
  45. data/docs/JsonapiCompliable/Util/IncludeParams.html +299 -0
  46. data/docs/JsonapiCompliable/Util/Persistence.html +435 -0
  47. data/docs/JsonapiCompliable/Util/RelationshipPayload.html +563 -0
  48. data/docs/JsonapiCompliable/Util/RenderOptions.html +250 -0
  49. data/docs/JsonapiCompliable/Util/ValidationResponse.html +532 -0
  50. data/docs/_index.html +527 -0
  51. data/docs/class_list.html +51 -0
  52. data/docs/css/common.css +1 -0
  53. data/docs/css/full_list.css +58 -0
  54. data/docs/css/style.css +492 -0
  55. data/docs/file.README.html +99 -0
  56. data/docs/file_list.html +56 -0
  57. data/docs/frames.html +17 -0
  58. data/docs/index.html +99 -0
  59. data/docs/js/app.js +248 -0
  60. data/docs/js/full_list.js +216 -0
  61. data/docs/js/jquery.js +4 -0
  62. data/docs/method_list.html +1731 -0
  63. data/docs/top-level-namespace.html +110 -0
  64. data/gemfiles/rails_5.gemfile +1 -1
  65. data/lib/jsonapi_compliable/adapters/abstract.rb +267 -4
  66. data/lib/jsonapi_compliable/adapters/active_record.rb +23 -1
  67. data/lib/jsonapi_compliable/adapters/null.rb +43 -3
  68. data/lib/jsonapi_compliable/base.rb +182 -33
  69. data/lib/jsonapi_compliable/deserializer.rb +90 -21
  70. data/lib/jsonapi_compliable/extensions/boolean_attribute.rb +12 -0
  71. data/lib/jsonapi_compliable/extensions/extra_attribute.rb +32 -0
  72. data/lib/jsonapi_compliable/extensions/temp_id.rb +11 -0
  73. data/lib/jsonapi_compliable/query.rb +94 -2
  74. data/lib/jsonapi_compliable/rails.rb +8 -0
  75. data/lib/jsonapi_compliable/resource.rb +548 -11
  76. data/lib/jsonapi_compliable/scope.rb +43 -1
  77. data/lib/jsonapi_compliable/scoping/base.rb +59 -8
  78. data/lib/jsonapi_compliable/scoping/default_filter.rb +33 -0
  79. data/lib/jsonapi_compliable/scoping/extra_fields.rb +33 -0
  80. data/lib/jsonapi_compliable/scoping/filter.rb +29 -2
  81. data/lib/jsonapi_compliable/scoping/filterable.rb +4 -0
  82. data/lib/jsonapi_compliable/scoping/paginate.rb +33 -0
  83. data/lib/jsonapi_compliable/scoping/sort.rb +18 -0
  84. data/lib/jsonapi_compliable/sideload.rb +229 -1
  85. data/lib/jsonapi_compliable/stats/dsl.rb +44 -0
  86. data/lib/jsonapi_compliable/stats/payload.rb +20 -0
  87. data/lib/jsonapi_compliable/util/field_params.rb +1 -0
  88. data/lib/jsonapi_compliable/util/hash.rb +18 -0
  89. data/lib/jsonapi_compliable/util/include_params.rb +22 -0
  90. data/lib/jsonapi_compliable/util/persistence.rb +13 -3
  91. data/lib/jsonapi_compliable/util/relationship_payload.rb +2 -0
  92. data/lib/jsonapi_compliable/util/render_options.rb +2 -0
  93. data/lib/jsonapi_compliable/util/validation_response.rb +16 -0
  94. data/lib/jsonapi_compliable/version.rb +1 -1
  95. metadata +60 -5
  96. data/gemfiles/rails_4.gemfile.lock +0 -208
  97. data/gemfiles/rails_5.gemfile.lock +0 -212
  98. data/lib/jsonapi_compliable/write.rb +0 -93
@@ -0,0 +1,1682 @@
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: JsonapiCompliable::Adapters::Null
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "JsonapiCompliable::Adapters::Null";
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 (N)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Adapters.html" title="JsonapiCompliable::Adapters (module)">Adapters</a></span></span>
41
+ &raquo;
42
+ <span class="title">Null</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: JsonapiCompliable::Adapters::Null
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="Abstract.html" title="JsonapiCompliable::Adapters::Abstract (class)">Abstract</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Abstract.html" title="JsonapiCompliable::Adapters::Abstract (class)">Abstract</a></span></li>
78
+
79
+ <li class="next">JsonapiCompliable::Adapters::Null</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/jsonapi_compliable/adapters/null.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>The Null adapter is a &#39;pass-through&#39; adapter. It won&#39;t modify
108
+ the scope. Useful when your customization does not support all possible
109
+ configuration (e.g. the service you hit does not support sorting)</p>
110
+
111
+
112
+ </div>
113
+ </div>
114
+ <div class="tags">
115
+
116
+
117
+ </div>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <h2>
126
+ Instance Method Summary
127
+ <small><a href="#" class="summary_toggle">collapse</a></small>
128
+ </h2>
129
+
130
+ <ul class="summary">
131
+
132
+ <li class="public ">
133
+ <span class="summary_signature">
134
+
135
+ <a href="#associate-instance_method" title="#associate (instance method)">#<strong>associate</strong>(parent, child, association_name, association_type) &#x21d2; Object </a>
136
+
137
+
138
+
139
+ </span>
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <span class="summary_desc"><div class='inline'>
150
+ <p>Assign these two objects together.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#average-instance_method" title="#average (instance method)">#<strong>average</strong>(scope, attr) &#x21d2; Float </a>
160
+
161
+
162
+
163
+ </span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <span class="summary_desc"><div class='inline'>
174
+ <p>The average of the scope.</p>
175
+ </div></span>
176
+
177
+ </li>
178
+
179
+
180
+ <li class="public ">
181
+ <span class="summary_signature">
182
+
183
+ <a href="#count-instance_method" title="#count (instance method)">#<strong>count</strong>(scope, attr) &#x21d2; Numeric </a>
184
+
185
+
186
+
187
+ </span>
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+ <span class="summary_desc"><div class='inline'>
198
+ <p>The count of the scope.</p>
199
+ </div></span>
200
+
201
+ </li>
202
+
203
+
204
+ <li class="public ">
205
+ <span class="summary_signature">
206
+
207
+ <a href="#filter-instance_method" title="#filter (instance method)">#<strong>filter</strong>(scope, attribute, value) &#x21d2; Object </a>
208
+
209
+
210
+
211
+ </span>
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+ <span class="summary_desc"><div class='inline'>
222
+ <p>The scope.</p>
223
+ </div></span>
224
+
225
+ </li>
226
+
227
+
228
+ <li class="public ">
229
+ <span class="summary_signature">
230
+
231
+ <a href="#maximum-instance_method" title="#maximum (instance method)">#<strong>maximum</strong>(scope, attr) &#x21d2; Numeric </a>
232
+
233
+
234
+
235
+ </span>
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+ <span class="summary_desc"><div class='inline'>
246
+ <p>The sum of the scope.</p>
247
+ </div></span>
248
+
249
+ </li>
250
+
251
+
252
+ <li class="public ">
253
+ <span class="summary_signature">
254
+
255
+ <a href="#minimum-instance_method" title="#minimum (instance method)">#<strong>minimum</strong>(scope, attr) &#x21d2; Numeric </a>
256
+
257
+
258
+
259
+ </span>
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ <span class="summary_desc"><div class='inline'>
270
+ <p>The maximum value of the scope.</p>
271
+ </div></span>
272
+
273
+ </li>
274
+
275
+
276
+ <li class="public ">
277
+ <span class="summary_signature">
278
+
279
+ <a href="#order-instance_method" title="#order (instance method)">#<strong>order</strong>(scope, attribute, direction) &#x21d2; Object </a>
280
+
281
+
282
+
283
+ </span>
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+ <span class="summary_desc"><div class='inline'>
294
+ <p>The scope.</p>
295
+ </div></span>
296
+
297
+ </li>
298
+
299
+
300
+ <li class="public ">
301
+ <span class="summary_signature">
302
+
303
+ <a href="#paginate-instance_method" title="#paginate (instance method)">#<strong>paginate</strong>(scope, current_page, per_page) &#x21d2; Object </a>
304
+
305
+
306
+
307
+ </span>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <span class="summary_desc"><div class='inline'>
318
+ <p>The scope.</p>
319
+ </div></span>
320
+
321
+ </li>
322
+
323
+
324
+ <li class="public ">
325
+ <span class="summary_signature">
326
+
327
+ <a href="#resolve-instance_method" title="#resolve (instance method)">#<strong>resolve</strong>(scope) &#x21d2; Object </a>
328
+
329
+
330
+
331
+ </span>
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+ <span class="summary_desc"><div class='inline'>
342
+ <p>Resolve the scope.</p>
343
+ </div></span>
344
+
345
+ </li>
346
+
347
+
348
+ <li class="public ">
349
+ <span class="summary_signature">
350
+
351
+ <a href="#sum-instance_method" title="#sum (instance method)">#<strong>sum</strong>(scope, attr) &#x21d2; Numeric </a>
352
+
353
+
354
+
355
+ </span>
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+ <span class="summary_desc"><div class='inline'>
366
+ <p>The sum of the scope.</p>
367
+ </div></span>
368
+
369
+ </li>
370
+
371
+
372
+ <li class="public ">
373
+ <span class="summary_signature">
374
+
375
+ <a href="#transaction-instance_method" title="#transaction (instance method)">#<strong>transaction</strong>(model_class) &#x21d2; Object </a>
376
+
377
+
378
+
379
+ </span>
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+ <span class="summary_desc"><div class='inline'>
390
+ <p>Since this is a null adapter, just yield.</p>
391
+ </div></span>
392
+
393
+ </li>
394
+
395
+
396
+ </ul>
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Abstract.html" title="JsonapiCompliable::Adapters::Abstract (class)">Abstract</a></span></h3>
409
+ <p class="inherited"><span class='object_link'><a href="Abstract.html#create-instance_method" title="JsonapiCompliable::Adapters::Abstract#create (method)">#create</a></span>, <span class='object_link'><a href="Abstract.html#destroy-instance_method" title="JsonapiCompliable::Adapters::Abstract#destroy (method)">#destroy</a></span>, <span class='object_link'><a href="Abstract.html#sideloading_module-instance_method" title="JsonapiCompliable::Adapters::Abstract#sideloading_module (method)">#sideloading_module</a></span>, <span class='object_link'><a href="Abstract.html#update-instance_method" title="JsonapiCompliable::Adapters::Abstract#update (method)">#update</a></span></p>
410
+
411
+
412
+ <div id="instance_method_details" class="method_details_list">
413
+ <h2>Instance Method Details</h2>
414
+
415
+
416
+ <div class="method_details first">
417
+ <h3 class="signature first" id="associate-instance_method">
418
+
419
+ #<strong>associate</strong>(parent, child, association_name, association_type) &#x21d2; <tt>Object</tt>
420
+
421
+
422
+
423
+
424
+
425
+ </h3><div class="docstring">
426
+ <div class="discussion">
427
+
428
+ <p>Assign these two objects together.</p>
429
+
430
+ <p><code>association_name</code> and <code>association_type</code> come from
431
+ your sideload configuration:</p>
432
+
433
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_allow_sideload'>allow_sideload</span> <span class='symbol'>:the_name</span><span class='comma'>,</span> <span class='label'>type:</span> <span class='id identifier rubyid_the_type'>the_type</span> <span class='kw'>do</span>
434
+ <span class='comment'># ... code.
435
+ </span><span class='kw'>end</span>
436
+ </code></pre>
437
+
438
+
439
+ </div>
440
+ </div>
441
+ <div class="tags">
442
+
443
+ <div class="examples">
444
+ <p class="tag_title">Examples:</p>
445
+
446
+
447
+ <p class="example_title"><div class='inline'>
448
+ <p>Basic accessor</p>
449
+ </div></p>
450
+
451
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_associate'>associate</span><span class='lparen'>(</span><span class='id identifier rubyid_parent'>parent</span><span class='comma'>,</span> <span class='id identifier rubyid_child'>child</span><span class='comma'>,</span> <span class='id identifier rubyid_association_name'>association_name</span><span class='comma'>,</span> <span class='id identifier rubyid_association_type'>association_type</span><span class='rparen'>)</span>
452
+ <span class='kw'>if</span> <span class='id identifier rubyid_association_type'>association_type</span> <span class='op'>==</span> <span class='symbol'>:has_many</span>
453
+ <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_association_name'>association_name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_child'>child</span><span class='rparen'>)</span>
454
+ <span class='kw'>else</span>
455
+ <span class='id identifier rubyid_child'>child</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:#{</span><span class='id identifier rubyid_association_name'>association_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_parent'>parent</span><span class='rparen'>)</span>
456
+ <span class='kw'>end</span>
457
+ <span class='kw'>end</span></code></pre>
458
+
459
+ </div>
460
+ <p class="tag_title">Parameters:</p>
461
+ <ul class="param">
462
+
463
+ <li>
464
+
465
+ <span class='name'>parent</span>
466
+
467
+
468
+ <span class='type'></span>
469
+
470
+
471
+
472
+ &mdash;
473
+ <div class='inline'>
474
+ <p>The parent object (via the JSONAPI &#39;relationships&#39; graph)</p>
475
+ </div>
476
+
477
+ </li>
478
+
479
+ <li>
480
+
481
+ <span class='name'>child</span>
482
+
483
+
484
+ <span class='type'></span>
485
+
486
+
487
+
488
+ &mdash;
489
+ <div class='inline'>
490
+ <p>The child object (via the JSONAPI &#39;relationships&#39; graph)</p>
491
+ </div>
492
+
493
+ </li>
494
+
495
+ <li>
496
+
497
+ <span class='name'>association_name</span>
498
+
499
+
500
+ <span class='type'></span>
501
+
502
+
503
+
504
+ &mdash;
505
+ <div class='inline'>
506
+ <p>The &#39;relationships&#39; key we are processing</p>
507
+ </div>
508
+
509
+ </li>
510
+
511
+ <li>
512
+
513
+ <span class='name'>association_type</span>
514
+
515
+
516
+ <span class='type'></span>
517
+
518
+
519
+
520
+ &mdash;
521
+ <div class='inline'>
522
+ <p>The Sideload type (see Sideload#type). Usually :has_many/:belongs_to/etc</p>
523
+ </div>
524
+
525
+ </li>
526
+
527
+ </ul>
528
+
529
+
530
+ </div><table class="source_code">
531
+ <tr>
532
+ <td>
533
+ <pre class="lines">
534
+
535
+
536
+ 61
537
+ 62</pre>
538
+ </td>
539
+ <td>
540
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 61</span>
541
+
542
+ <span class='kw'>def</span> <span class='id identifier rubyid_associate'>associate</span><span class='lparen'>(</span><span class='id identifier rubyid_parent'>parent</span><span class='comma'>,</span> <span class='id identifier rubyid_child'>child</span><span class='comma'>,</span> <span class='id identifier rubyid_association_name'>association_name</span><span class='comma'>,</span> <span class='id identifier rubyid_association_type'>association_type</span><span class='rparen'>)</span>
543
+ <span class='kw'>end</span></pre>
544
+ </td>
545
+ </tr>
546
+ </table>
547
+ </div>
548
+
549
+ <div class="method_details ">
550
+ <h3 class="signature " id="average-instance_method">
551
+
552
+ #<strong>average</strong>(scope, attr) &#x21d2; <tt>Float</tt>
553
+
554
+
555
+
556
+
557
+
558
+ </h3><div class="docstring">
559
+ <div class="discussion">
560
+
561
+ <p>Returns the average of the scope</p>
562
+
563
+
564
+ </div>
565
+ </div>
566
+ <div class="tags">
567
+
568
+ <div class="examples">
569
+ <p class="tag_title">Examples:</p>
570
+
571
+
572
+ <p class="example_title"><div class='inline'>
573
+ <p>ActiveRecord default</p>
574
+ </div></p>
575
+
576
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_average'>average</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
577
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_average'>average</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
578
+ <span class='kw'>end</span></code></pre>
579
+
580
+ </div>
581
+ <p class="tag_title">Parameters:</p>
582
+ <ul class="param">
583
+
584
+ <li>
585
+
586
+ <span class='name'>scope</span>
587
+
588
+
589
+ <span class='type'></span>
590
+
591
+
592
+
593
+ &mdash;
594
+ <div class='inline'>
595
+ <p>the scope object we are chaining</p>
596
+ </div>
597
+
598
+ </li>
599
+
600
+ <li>
601
+
602
+ <span class='name'>attr</span>
603
+
604
+
605
+ <span class='type'>(<tt>Symbol</tt>)</span>
606
+
607
+
608
+
609
+ &mdash;
610
+ <div class='inline'>
611
+ <p>corresponding stat attribute name</p>
612
+ </div>
613
+
614
+ </li>
615
+
616
+ </ul>
617
+
618
+ <p class="tag_title">Returns:</p>
619
+ <ul class="return">
620
+
621
+ <li>
622
+
623
+
624
+ <span class='type'>(<tt>Float</tt>)</span>
625
+
626
+
627
+
628
+ &mdash;
629
+ <div class='inline'>
630
+ <p>the average of the scope</p>
631
+ </div>
632
+
633
+ </li>
634
+
635
+ </ul>
636
+
637
+ </div><table class="source_code">
638
+ <tr>
639
+ <td>
640
+ <pre class="lines">
641
+
642
+
643
+ 28
644
+ 29
645
+ 30</pre>
646
+ </td>
647
+ <td>
648
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 28</span>
649
+
650
+ <span class='kw'>def</span> <span class='id identifier rubyid_average'>average</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
651
+ <span class='id identifier rubyid_scope'>scope</span>
652
+ <span class='kw'>end</span></pre>
653
+ </td>
654
+ </tr>
655
+ </table>
656
+ </div>
657
+
658
+ <div class="method_details ">
659
+ <h3 class="signature " id="count-instance_method">
660
+
661
+ #<strong>count</strong>(scope, attr) &#x21d2; <tt>Numeric</tt>
662
+
663
+
664
+
665
+
666
+
667
+ </h3><div class="docstring">
668
+ <div class="discussion">
669
+
670
+ <p>Returns the count of the scope</p>
671
+
672
+
673
+ </div>
674
+ </div>
675
+ <div class="tags">
676
+
677
+ <div class="examples">
678
+ <p class="tag_title">Examples:</p>
679
+
680
+
681
+ <p class="example_title"><div class='inline'>
682
+ <p>ActiveRecord default</p>
683
+ </div></p>
684
+
685
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
686
+ <span class='id identifier rubyid_column'>column</span> <span class='op'>=</span> <span class='id identifier rubyid_attr'>attr</span> <span class='op'>==</span> <span class='symbol'>:total</span> <span class='op'>?</span> <span class='symbol'>:all</span> <span class='op'>:</span> <span class='id identifier rubyid_attr'>attr</span>
687
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
688
+ <span class='kw'>end</span></code></pre>
689
+
690
+ </div>
691
+ <p class="tag_title">Parameters:</p>
692
+ <ul class="param">
693
+
694
+ <li>
695
+
696
+ <span class='name'>scope</span>
697
+
698
+
699
+ <span class='type'></span>
700
+
701
+
702
+
703
+ &mdash;
704
+ <div class='inline'>
705
+ <p>the scope object we are chaining</p>
706
+ </div>
707
+
708
+ </li>
709
+
710
+ <li>
711
+
712
+ <span class='name'>attr</span>
713
+
714
+
715
+ <span class='type'>(<tt>Symbol</tt>)</span>
716
+
717
+
718
+
719
+ &mdash;
720
+ <div class='inline'>
721
+ <p>corresponding stat attribute name</p>
722
+ </div>
723
+
724
+ </li>
725
+
726
+ </ul>
727
+
728
+ <p class="tag_title">Returns:</p>
729
+ <ul class="return">
730
+
731
+ <li>
732
+
733
+
734
+ <span class='type'>(<tt>Numeric</tt>)</span>
735
+
736
+
737
+
738
+ &mdash;
739
+ <div class='inline'>
740
+ <p>the count of the scope</p>
741
+ </div>
742
+
743
+ </li>
744
+
745
+ </ul>
746
+
747
+ </div><table class="source_code">
748
+ <tr>
749
+ <td>
750
+ <pre class="lines">
751
+
752
+
753
+ 23
754
+ 24
755
+ 25</pre>
756
+ </td>
757
+ <td>
758
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 23</span>
759
+
760
+ <span class='kw'>def</span> <span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
761
+ <span class='id identifier rubyid_scope'>scope</span>
762
+ <span class='kw'>end</span></pre>
763
+ </td>
764
+ </tr>
765
+ </table>
766
+ </div>
767
+
768
+ <div class="method_details ">
769
+ <h3 class="signature " id="filter-instance_method">
770
+
771
+ #<strong>filter</strong>(scope, attribute, value) &#x21d2; <tt>Object</tt>
772
+
773
+
774
+
775
+
776
+
777
+ </h3><div class="docstring">
778
+ <div class="discussion">
779
+
780
+ <p>Returns the scope</p>
781
+
782
+
783
+ </div>
784
+ </div>
785
+ <div class="tags">
786
+
787
+ <div class="examples">
788
+ <p class="tag_title">Examples:</p>
789
+
790
+
791
+ <p class="example_title"><div class='inline'>
792
+ <p>ActiveRecord default</p>
793
+ </div></p>
794
+
795
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_filter'>filter</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
796
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
797
+ <span class='kw'>end</span></code></pre>
798
+
799
+ </div>
800
+ <p class="tag_title">Parameters:</p>
801
+ <ul class="param">
802
+
803
+ <li>
804
+
805
+ <span class='name'>scope</span>
806
+
807
+
808
+ <span class='type'></span>
809
+
810
+
811
+
812
+ &mdash;
813
+ <div class='inline'>
814
+ <p>The scope object we are chaining</p>
815
+ </div>
816
+
817
+ </li>
818
+
819
+ <li>
820
+
821
+ <span class='name'>attribute</span>
822
+
823
+
824
+ <span class='type'>(<tt>Symbol</tt>)</span>
825
+
826
+
827
+
828
+ &mdash;
829
+ <div class='inline'>
830
+ <p>The attribute name we are filtering</p>
831
+ </div>
832
+
833
+ </li>
834
+
835
+ <li>
836
+
837
+ <span class='name'>value</span>
838
+
839
+
840
+ <span class='type'></span>
841
+
842
+
843
+
844
+ &mdash;
845
+ <div class='inline'>
846
+ <p>The corresponding query parameter value</p>
847
+ </div>
848
+
849
+ </li>
850
+
851
+ </ul>
852
+
853
+ <p class="tag_title">Returns:</p>
854
+ <ul class="return">
855
+
856
+ <li>
857
+
858
+
859
+ <span class='type'></span>
860
+
861
+
862
+
863
+
864
+ <div class='inline'>
865
+ <p>the scope</p>
866
+ </div>
867
+
868
+ </li>
869
+
870
+ </ul>
871
+
872
+ </div><table class="source_code">
873
+ <tr>
874
+ <td>
875
+ <pre class="lines">
876
+
877
+
878
+ 8
879
+ 9
880
+ 10</pre>
881
+ </td>
882
+ <td>
883
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 8</span>
884
+
885
+ <span class='kw'>def</span> <span class='id identifier rubyid_filter'>filter</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
886
+ <span class='id identifier rubyid_scope'>scope</span>
887
+ <span class='kw'>end</span></pre>
888
+ </td>
889
+ </tr>
890
+ </table>
891
+ </div>
892
+
893
+ <div class="method_details ">
894
+ <h3 class="signature " id="maximum-instance_method">
895
+
896
+ #<strong>maximum</strong>(scope, attr) &#x21d2; <tt>Numeric</tt>
897
+
898
+
899
+
900
+
901
+
902
+ </h3><div class="docstring">
903
+ <div class="discussion">
904
+
905
+ <p>Returns the sum of the scope</p>
906
+
907
+
908
+ </div>
909
+ </div>
910
+ <div class="tags">
911
+
912
+ <div class="examples">
913
+ <p class="tag_title">Examples:</p>
914
+
915
+
916
+ <p class="example_title"><div class='inline'>
917
+ <p>ActiveRecord default</p>
918
+ </div></p>
919
+
920
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_sum'>sum</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
921
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_sum'>sum</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
922
+ <span class='kw'>end</span></code></pre>
923
+
924
+ </div>
925
+ <p class="tag_title">Parameters:</p>
926
+ <ul class="param">
927
+
928
+ <li>
929
+
930
+ <span class='name'>scope</span>
931
+
932
+
933
+ <span class='type'></span>
934
+
935
+
936
+
937
+ &mdash;
938
+ <div class='inline'>
939
+ <p>the scope object we are chaining</p>
940
+ </div>
941
+
942
+ </li>
943
+
944
+ <li>
945
+
946
+ <span class='name'>attr</span>
947
+
948
+
949
+ <span class='type'>(<tt>Symbol</tt>)</span>
950
+
951
+
952
+
953
+ &mdash;
954
+ <div class='inline'>
955
+ <p>corresponding stat attribute name</p>
956
+ </div>
957
+
958
+ </li>
959
+
960
+ </ul>
961
+
962
+ <p class="tag_title">Returns:</p>
963
+ <ul class="return">
964
+
965
+ <li>
966
+
967
+
968
+ <span class='type'>(<tt>Numeric</tt>)</span>
969
+
970
+
971
+
972
+ &mdash;
973
+ <div class='inline'>
974
+ <p>the sum of the scope</p>
975
+ </div>
976
+
977
+ </li>
978
+
979
+ </ul>
980
+
981
+ </div><table class="source_code">
982
+ <tr>
983
+ <td>
984
+ <pre class="lines">
985
+
986
+
987
+ 38
988
+ 39
989
+ 40</pre>
990
+ </td>
991
+ <td>
992
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 38</span>
993
+
994
+ <span class='kw'>def</span> <span class='id identifier rubyid_maximum'>maximum</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
995
+ <span class='id identifier rubyid_scope'>scope</span>
996
+ <span class='kw'>end</span></pre>
997
+ </td>
998
+ </tr>
999
+ </table>
1000
+ </div>
1001
+
1002
+ <div class="method_details ">
1003
+ <h3 class="signature " id="minimum-instance_method">
1004
+
1005
+ #<strong>minimum</strong>(scope, attr) &#x21d2; <tt>Numeric</tt>
1006
+
1007
+
1008
+
1009
+
1010
+
1011
+ </h3><div class="docstring">
1012
+ <div class="discussion">
1013
+
1014
+ <p>Returns the maximum value of the scope</p>
1015
+
1016
+
1017
+ </div>
1018
+ </div>
1019
+ <div class="tags">
1020
+
1021
+ <div class="examples">
1022
+ <p class="tag_title">Examples:</p>
1023
+
1024
+
1025
+ <p class="example_title"><div class='inline'>
1026
+ <p>ActiveRecord default</p>
1027
+ </div></p>
1028
+
1029
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_maximum'>maximum</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
1030
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_maximum'>maximum</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
1031
+ <span class='kw'>end</span></code></pre>
1032
+
1033
+ </div>
1034
+ <p class="tag_title">Parameters:</p>
1035
+ <ul class="param">
1036
+
1037
+ <li>
1038
+
1039
+ <span class='name'>scope</span>
1040
+
1041
+
1042
+ <span class='type'></span>
1043
+
1044
+
1045
+
1046
+ &mdash;
1047
+ <div class='inline'>
1048
+ <p>the scope object we are chaining</p>
1049
+ </div>
1050
+
1051
+ </li>
1052
+
1053
+ <li>
1054
+
1055
+ <span class='name'>attr</span>
1056
+
1057
+
1058
+ <span class='type'>(<tt>Symbol</tt>)</span>
1059
+
1060
+
1061
+
1062
+ &mdash;
1063
+ <div class='inline'>
1064
+ <p>corresponding stat attribute name</p>
1065
+ </div>
1066
+
1067
+ </li>
1068
+
1069
+ </ul>
1070
+
1071
+ <p class="tag_title">Returns:</p>
1072
+ <ul class="return">
1073
+
1074
+ <li>
1075
+
1076
+
1077
+ <span class='type'>(<tt>Numeric</tt>)</span>
1078
+
1079
+
1080
+
1081
+ &mdash;
1082
+ <div class='inline'>
1083
+ <p>the maximum value of the scope</p>
1084
+ </div>
1085
+
1086
+ </li>
1087
+
1088
+ </ul>
1089
+
1090
+ </div><table class="source_code">
1091
+ <tr>
1092
+ <td>
1093
+ <pre class="lines">
1094
+
1095
+
1096
+ 43
1097
+ 44
1098
+ 45</pre>
1099
+ </td>
1100
+ <td>
1101
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 43</span>
1102
+
1103
+ <span class='kw'>def</span> <span class='id identifier rubyid_minimum'>minimum</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
1104
+ <span class='id identifier rubyid_scope'>scope</span>
1105
+ <span class='kw'>end</span></pre>
1106
+ </td>
1107
+ </tr>
1108
+ </table>
1109
+ </div>
1110
+
1111
+ <div class="method_details ">
1112
+ <h3 class="signature " id="order-instance_method">
1113
+
1114
+ #<strong>order</strong>(scope, attribute, direction) &#x21d2; <tt>Object</tt>
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+ </h3><div class="docstring">
1121
+ <div class="discussion">
1122
+
1123
+ <p>Returns the scope</p>
1124
+
1125
+
1126
+ </div>
1127
+ </div>
1128
+ <div class="tags">
1129
+
1130
+ <div class="examples">
1131
+ <p class="tag_title">Examples:</p>
1132
+
1133
+
1134
+ <p class="example_title"><div class='inline'>
1135
+ <p>ActiveRecord default</p>
1136
+ </div></p>
1137
+
1138
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
1139
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
1140
+ <span class='kw'>end</span></code></pre>
1141
+
1142
+ </div>
1143
+ <p class="tag_title">Parameters:</p>
1144
+ <ul class="param">
1145
+
1146
+ <li>
1147
+
1148
+ <span class='name'>scope</span>
1149
+
1150
+
1151
+ <span class='type'></span>
1152
+
1153
+
1154
+
1155
+ &mdash;
1156
+ <div class='inline'>
1157
+ <p>The scope object we are chaining</p>
1158
+ </div>
1159
+
1160
+ </li>
1161
+
1162
+ <li>
1163
+
1164
+ <span class='name'>attribute</span>
1165
+
1166
+
1167
+ <span class='type'>(<tt>Symbol</tt>)</span>
1168
+
1169
+
1170
+
1171
+ &mdash;
1172
+ <div class='inline'>
1173
+ <p>The attribute name we are sorting</p>
1174
+ </div>
1175
+
1176
+ </li>
1177
+
1178
+ <li>
1179
+
1180
+ <span class='name'>direction</span>
1181
+
1182
+
1183
+ <span class='type'>(<tt>Symbol</tt>)</span>
1184
+
1185
+
1186
+
1187
+ &mdash;
1188
+ <div class='inline'>
1189
+ <p>The direction we are sorting (asc/desc)</p>
1190
+ </div>
1191
+
1192
+ </li>
1193
+
1194
+ </ul>
1195
+
1196
+ <p class="tag_title">Returns:</p>
1197
+ <ul class="return">
1198
+
1199
+ <li>
1200
+
1201
+
1202
+ <span class='type'></span>
1203
+
1204
+
1205
+
1206
+
1207
+ <div class='inline'>
1208
+ <p>the scope</p>
1209
+ </div>
1210
+
1211
+ </li>
1212
+
1213
+ </ul>
1214
+
1215
+ </div><table class="source_code">
1216
+ <tr>
1217
+ <td>
1218
+ <pre class="lines">
1219
+
1220
+
1221
+ 13
1222
+ 14
1223
+ 15</pre>
1224
+ </td>
1225
+ <td>
1226
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 13</span>
1227
+
1228
+ <span class='kw'>def</span> <span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
1229
+ <span class='id identifier rubyid_scope'>scope</span>
1230
+ <span class='kw'>end</span></pre>
1231
+ </td>
1232
+ </tr>
1233
+ </table>
1234
+ </div>
1235
+
1236
+ <div class="method_details ">
1237
+ <h3 class="signature " id="paginate-instance_method">
1238
+
1239
+ #<strong>paginate</strong>(scope, current_page, per_page) &#x21d2; <tt>Object</tt>
1240
+
1241
+
1242
+
1243
+
1244
+
1245
+ </h3><div class="docstring">
1246
+ <div class="discussion">
1247
+
1248
+ <p>Returns the scope</p>
1249
+
1250
+
1251
+ </div>
1252
+ </div>
1253
+ <div class="tags">
1254
+
1255
+ <div class="examples">
1256
+ <p class="tag_title">Examples:</p>
1257
+
1258
+
1259
+ <p class="example_title"><div class='inline'>
1260
+ <p>ActiveRecord default</p>
1261
+ </div></p>
1262
+
1263
+ <pre class="example code"><code><span class='comment'># via kaminari gem
1264
+ </span><span class='kw'>def</span> <span class='id identifier rubyid_paginate'>paginate</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_current_page'>current_page</span><span class='comma'>,</span> <span class='id identifier rubyid_per_page'>per_page</span><span class='rparen'>)</span>
1265
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_page'>page</span><span class='lparen'>(</span><span class='id identifier rubyid_current_page'>current_page</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_per'>per</span><span class='lparen'>(</span><span class='id identifier rubyid_per_page'>per_page</span><span class='rparen'>)</span>
1266
+ <span class='kw'>end</span></code></pre>
1267
+
1268
+ </div>
1269
+ <p class="tag_title">Parameters:</p>
1270
+ <ul class="param">
1271
+
1272
+ <li>
1273
+
1274
+ <span class='name'>scope</span>
1275
+
1276
+
1277
+ <span class='type'></span>
1278
+
1279
+
1280
+
1281
+ &mdash;
1282
+ <div class='inline'>
1283
+ <p>The scope object we are chaining</p>
1284
+ </div>
1285
+
1286
+ </li>
1287
+
1288
+ <li>
1289
+
1290
+ <span class='name'>current_page</span>
1291
+
1292
+
1293
+ <span class='type'>(<tt>Integer</tt>)</span>
1294
+
1295
+
1296
+
1297
+ &mdash;
1298
+ <div class='inline'>
1299
+ <p>The current page number</p>
1300
+ </div>
1301
+
1302
+ </li>
1303
+
1304
+ <li>
1305
+
1306
+ <span class='name'>per_page</span>
1307
+
1308
+
1309
+ <span class='type'>(<tt>Integer</tt>)</span>
1310
+
1311
+
1312
+
1313
+ &mdash;
1314
+ <div class='inline'>
1315
+ <p>The number of results per page</p>
1316
+ </div>
1317
+
1318
+ </li>
1319
+
1320
+ </ul>
1321
+
1322
+ <p class="tag_title">Returns:</p>
1323
+ <ul class="return">
1324
+
1325
+ <li>
1326
+
1327
+
1328
+ <span class='type'></span>
1329
+
1330
+
1331
+
1332
+
1333
+ <div class='inline'>
1334
+ <p>the scope</p>
1335
+ </div>
1336
+
1337
+ </li>
1338
+
1339
+ </ul>
1340
+
1341
+ </div><table class="source_code">
1342
+ <tr>
1343
+ <td>
1344
+ <pre class="lines">
1345
+
1346
+
1347
+ 18
1348
+ 19
1349
+ 20</pre>
1350
+ </td>
1351
+ <td>
1352
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 18</span>
1353
+
1354
+ <span class='kw'>def</span> <span class='id identifier rubyid_paginate'>paginate</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_current_page'>current_page</span><span class='comma'>,</span> <span class='id identifier rubyid_per_page'>per_page</span><span class='rparen'>)</span>
1355
+ <span class='id identifier rubyid_scope'>scope</span>
1356
+ <span class='kw'>end</span></pre>
1357
+ </td>
1358
+ </tr>
1359
+ </table>
1360
+ </div>
1361
+
1362
+ <div class="method_details ">
1363
+ <h3 class="signature " id="resolve-instance_method">
1364
+
1365
+ #<strong>resolve</strong>(scope) &#x21d2; <tt>Object</tt>
1366
+
1367
+
1368
+
1369
+
1370
+
1371
+ </h3><div class="docstring">
1372
+ <div class="discussion">
1373
+
1374
+ <p>Resolve the scope. This is where you&#39;d actually fire SQL, actually make
1375
+ an HTTP call, etc.</p>
1376
+
1377
+
1378
+ </div>
1379
+ </div>
1380
+ <div class="tags">
1381
+
1382
+ <div class="examples">
1383
+ <p class="tag_title">Examples:</p>
1384
+
1385
+
1386
+ <p class="example_title"><div class='inline'>
1387
+ <p>ActiveRecordDefault</p>
1388
+ </div></p>
1389
+
1390
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_resolve'>resolve</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='rparen'>)</span>
1391
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span>
1392
+ <span class='kw'>end</span></code></pre>
1393
+
1394
+
1395
+ <p class="example_title"><div class='inline'>
1396
+ <p>Suggested Customization</p>
1397
+ </div></p>
1398
+
1399
+ <pre class="example code"><code><span class='comment'># When making a service call, we suggest this abstraction
1400
+ </span><span class='comment'># &#39;scope&#39; here is a hash
1401
+ </span><span class='kw'>def</span> <span class='id identifier rubyid_resolve'>resolve</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='rparen'>)</span>
1402
+ <span class='comment'># The implementation of .where can be whatever you want
1403
+ </span> <span class='const'>SomeModelClass</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='rparen'>)</span>
1404
+ <span class='kw'>end</span></code></pre>
1405
+
1406
+ </div>
1407
+ <p class="tag_title">Parameters:</p>
1408
+ <ul class="param">
1409
+
1410
+ <li>
1411
+
1412
+ <span class='name'>scope</span>
1413
+
1414
+
1415
+ <span class='type'></span>
1416
+
1417
+
1418
+
1419
+ &mdash;
1420
+ <div class='inline'>
1421
+ <p>The scope object to resolve</p>
1422
+ </div>
1423
+
1424
+ </li>
1425
+
1426
+ </ul>
1427
+
1428
+ <p class="tag_title">Returns:</p>
1429
+ <ul class="return">
1430
+
1431
+ <li>
1432
+
1433
+
1434
+ <span class='type'></span>
1435
+
1436
+
1437
+
1438
+
1439
+ <div class='inline'>
1440
+ <p>an array of Model instances</p>
1441
+ </div>
1442
+
1443
+ </li>
1444
+
1445
+ </ul>
1446
+
1447
+ <p class="tag_title">See Also:</p>
1448
+ <ul class="see">
1449
+
1450
+ <li><span class='object_link'><a href="ActiveRecord.html#resolve-instance_method" title="JsonapiCompliable::Adapters::ActiveRecord#resolve (method)">ActiveRecord#resolve</a></span></li>
1451
+
1452
+ </ul>
1453
+
1454
+ </div><table class="source_code">
1455
+ <tr>
1456
+ <td>
1457
+ <pre class="lines">
1458
+
1459
+
1460
+ 56
1461
+ 57
1462
+ 58</pre>
1463
+ </td>
1464
+ <td>
1465
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 56</span>
1466
+
1467
+ <span class='kw'>def</span> <span class='id identifier rubyid_resolve'>resolve</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='rparen'>)</span>
1468
+ <span class='id identifier rubyid_scope'>scope</span>
1469
+ <span class='kw'>end</span></pre>
1470
+ </td>
1471
+ </tr>
1472
+ </table>
1473
+ </div>
1474
+
1475
+ <div class="method_details ">
1476
+ <h3 class="signature " id="sum-instance_method">
1477
+
1478
+ #<strong>sum</strong>(scope, attr) &#x21d2; <tt>Numeric</tt>
1479
+
1480
+
1481
+
1482
+
1483
+
1484
+ </h3><div class="docstring">
1485
+ <div class="discussion">
1486
+
1487
+ <p>Returns the sum of the scope</p>
1488
+
1489
+
1490
+ </div>
1491
+ </div>
1492
+ <div class="tags">
1493
+
1494
+ <div class="examples">
1495
+ <p class="tag_title">Examples:</p>
1496
+
1497
+
1498
+ <p class="example_title"><div class='inline'>
1499
+ <p>ActiveRecord default</p>
1500
+ </div></p>
1501
+
1502
+ <pre class="example code"><code><span class='kw'>def</span> <span class='id identifier rubyid_sum'>sum</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
1503
+ <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_sum'>sum</span><span class='lparen'>(</span><span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
1504
+ <span class='kw'>end</span></code></pre>
1505
+
1506
+ </div>
1507
+ <p class="tag_title">Parameters:</p>
1508
+ <ul class="param">
1509
+
1510
+ <li>
1511
+
1512
+ <span class='name'>scope</span>
1513
+
1514
+
1515
+ <span class='type'></span>
1516
+
1517
+
1518
+
1519
+ &mdash;
1520
+ <div class='inline'>
1521
+ <p>the scope object we are chaining</p>
1522
+ </div>
1523
+
1524
+ </li>
1525
+
1526
+ <li>
1527
+
1528
+ <span class='name'>attr</span>
1529
+
1530
+
1531
+ <span class='type'>(<tt>Symbol</tt>)</span>
1532
+
1533
+
1534
+
1535
+ &mdash;
1536
+ <div class='inline'>
1537
+ <p>corresponding stat attribute name</p>
1538
+ </div>
1539
+
1540
+ </li>
1541
+
1542
+ </ul>
1543
+
1544
+ <p class="tag_title">Returns:</p>
1545
+ <ul class="return">
1546
+
1547
+ <li>
1548
+
1549
+
1550
+ <span class='type'>(<tt>Numeric</tt>)</span>
1551
+
1552
+
1553
+
1554
+ &mdash;
1555
+ <div class='inline'>
1556
+ <p>the sum of the scope</p>
1557
+ </div>
1558
+
1559
+ </li>
1560
+
1561
+ </ul>
1562
+
1563
+ </div><table class="source_code">
1564
+ <tr>
1565
+ <td>
1566
+ <pre class="lines">
1567
+
1568
+
1569
+ 33
1570
+ 34
1571
+ 35</pre>
1572
+ </td>
1573
+ <td>
1574
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 33</span>
1575
+
1576
+ <span class='kw'>def</span> <span class='id identifier rubyid_sum'>sum</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
1577
+ <span class='id identifier rubyid_scope'>scope</span>
1578
+ <span class='kw'>end</span></pre>
1579
+ </td>
1580
+ </tr>
1581
+ </table>
1582
+ </div>
1583
+
1584
+ <div class="method_details ">
1585
+ <h3 class="signature " id="transaction-instance_method">
1586
+
1587
+ #<strong>transaction</strong>(model_class) &#x21d2; <tt>Object</tt>
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+ </h3><div class="docstring">
1594
+ <div class="discussion">
1595
+
1596
+ <p>Since this is a null adapter, just yield</p>
1597
+
1598
+
1599
+ </div>
1600
+ </div>
1601
+ <div class="tags">
1602
+ <p class="tag_title">Parameters:</p>
1603
+ <ul class="param">
1604
+
1605
+ <li>
1606
+
1607
+ <span class='name'>model_class</span>
1608
+
1609
+
1610
+ <span class='type'>(<tt>Class</tt>)</span>
1611
+
1612
+
1613
+
1614
+ &mdash;
1615
+ <div class='inline'>
1616
+ <p>The class we&#39;re operating on</p>
1617
+ </div>
1618
+
1619
+ </li>
1620
+
1621
+ </ul>
1622
+
1623
+ <p class="tag_title">Returns:</p>
1624
+ <ul class="return">
1625
+
1626
+ <li>
1627
+
1628
+
1629
+ <span class='type'></span>
1630
+
1631
+
1632
+
1633
+
1634
+ <div class='inline'>
1635
+ <p>Result of yield</p>
1636
+ </div>
1637
+
1638
+ </li>
1639
+
1640
+ </ul>
1641
+
1642
+ <p class="tag_title">See Also:</p>
1643
+ <ul class="see">
1644
+
1645
+ <li><span class='object_link'><a href="ActiveRecord.html#transaction-instance_method" title="JsonapiCompliable::Adapters::ActiveRecord#transaction (method)">ActiveRecord#transaction</a></span></li>
1646
+
1647
+ </ul>
1648
+
1649
+ </div><table class="source_code">
1650
+ <tr>
1651
+ <td>
1652
+ <pre class="lines">
1653
+
1654
+
1655
+ 51
1656
+ 52
1657
+ 53</pre>
1658
+ </td>
1659
+ <td>
1660
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/adapters/null.rb', line 51</span>
1661
+
1662
+ <span class='kw'>def</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='lparen'>(</span><span class='id identifier rubyid_model_class'>model_class</span><span class='rparen'>)</span>
1663
+ <span class='kw'>yield</span>
1664
+ <span class='kw'>end</span></pre>
1665
+ </td>
1666
+ </tr>
1667
+ </table>
1668
+ </div>
1669
+
1670
+ </div>
1671
+
1672
+ </div>
1673
+
1674
+ <div id="footer">
1675
+ Generated on Fri May 5 15:53:23 2017 by
1676
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1677
+ 0.9.9 (ruby-2.3.0).
1678
+ </div>
1679
+
1680
+ </div>
1681
+ </body>
1682
+ </html>