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,117 @@
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
+ Module: JsonapiCompliable::Scoping
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::Scoping";
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 (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span>
41
+ &raquo;
42
+ <span class="title">Scoping</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>Module: JsonapiCompliable::Scoping
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/jsonapi_compliable/scoping/base.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+ <h2>Defined Under Namespace</h2>
87
+ <p class="children">
88
+
89
+
90
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Scoping/Filterable.html" title="JsonapiCompliable::Scoping::Filterable (module)">Filterable</a></span>
91
+
92
+
93
+
94
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Scoping/Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span>, <span class='object_link'><a href="Scoping/DefaultFilter.html" title="JsonapiCompliable::Scoping::DefaultFilter (class)">DefaultFilter</a></span>, <span class='object_link'><a href="Scoping/ExtraFields.html" title="JsonapiCompliable::Scoping::ExtraFields (class)">ExtraFields</a></span>, <span class='object_link'><a href="Scoping/Filter.html" title="JsonapiCompliable::Scoping::Filter (class)">Filter</a></span>, <span class='object_link'><a href="Scoping/Paginate.html" title="JsonapiCompliable::Scoping::Paginate (class)">Paginate</a></span>, <span class='object_link'><a href="Scoping/Sort.html" title="JsonapiCompliable::Scoping::Sort (class)">Sort</a></span>
95
+
96
+
97
+ </p>
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ </div>
108
+
109
+ <div id="footer">
110
+ Generated on Fri May 5 15:53:21 2017 by
111
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
+ 0.9.9 (ruby-2.3.0).
113
+ </div>
114
+
115
+ </div>
116
+ </body>
117
+ </html>
@@ -0,0 +1,843 @@
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::Scoping::Base
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::Scoping::Base";
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="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Scoping.html" title="JsonapiCompliable::Scoping (module)">Scoping</a></span></span>
41
+ &raquo;
42
+ <span class="title">Base</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::Scoping::Base
63
+
64
+
65
+
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">JsonapiCompliable::Scoping::Base</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/jsonapi_compliable/scoping/base.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>The interface for scoping logic (filter, paginate, etc).</p>
106
+
107
+ <p>This class defines some common behavior, such as falling back on a default
108
+ if not part of the user request.</p>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+
116
+ <p class="tag_title">See Also:</p>
117
+ <ul class="see">
118
+
119
+ <li><span class='object_link'><a href="DefaultFilter.html" title="JsonapiCompliable::Scoping::DefaultFilter (class)">DefaultFilter</a></span></li>
120
+
121
+ <li><span class='object_link'><a href="ExtraFields.html" title="JsonapiCompliable::Scoping::ExtraFields (class)">ExtraFields</a></span></li>
122
+
123
+ <li><span class='object_link'><a href="Filter.html" title="JsonapiCompliable::Scoping::Filter (class)">Filter</a></span></li>
124
+
125
+ <li><span class='object_link'><a href="Paginate.html" title="JsonapiCompliable::Scoping::Paginate (class)">Paginate</a></span></li>
126
+
127
+ <li><span class='object_link'><a href="Sort.html" title="JsonapiCompliable::Scoping::Sort (class)">Sort</a></span></li>
128
+
129
+ <li><span class='object_link'><a href="../Scope.html#initialize-instance_method" title="JsonapiCompliable::Scope#initialize (method)">JsonapiCompliable::Scope#initialize</a></span></li>
130
+
131
+ <li><span class='object_link'><a href="../Scope.html#query_hash-instance_method" title="JsonapiCompliable::Scope#query_hash (method)">JsonapiCompliable::Scope#query_hash</a></span></li>
132
+
133
+ <li><span class='object_link'><a href="../Query.html#to_hash-instance_method" title="JsonapiCompliable::Query#to_hash (method)">Query#to_hash</a></span></li>
134
+
135
+ </ul>
136
+
137
+ </div><div id="subclasses">
138
+ <h2>Direct Known Subclasses</h2>
139
+ <p class="children"><span class='object_link'><a href="DefaultFilter.html" title="JsonapiCompliable::Scoping::DefaultFilter (class)">DefaultFilter</a></span>, <span class='object_link'><a href="ExtraFields.html" title="JsonapiCompliable::Scoping::ExtraFields (class)">ExtraFields</a></span>, <span class='object_link'><a href="Filter.html" title="JsonapiCompliable::Scoping::Filter (class)">Filter</a></span>, <span class='object_link'><a href="Paginate.html" title="JsonapiCompliable::Scoping::Paginate (class)">Paginate</a></span>, <span class='object_link'><a href="Sort.html" title="JsonapiCompliable::Scoping::Sort (class)">Sort</a></span></p>
140
+ </div>
141
+
142
+
143
+
144
+
145
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
146
+ <ul class="summary">
147
+
148
+ <li class="public ">
149
+ <span class="summary_signature">
150
+
151
+ <a href="#query_hash-instance_method" title="#query_hash (instance method)">#<strong>query_hash</strong> &#x21d2; Hash </a>
152
+
153
+
154
+
155
+ </span>
156
+
157
+
158
+
159
+
160
+ <span class="note title readonly">readonly</span>
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"><div class='inline'>
171
+ <p>the Query#to_hash node relevant to the current resource.</p>
172
+ </div></span>
173
+
174
+ </li>
175
+
176
+
177
+ <li class="public ">
178
+ <span class="summary_signature">
179
+
180
+ <a href="#resource-instance_method" title="#resource (instance method)">#<strong>resource</strong> &#x21d2; Resource </a>
181
+
182
+
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+ <span class="note title readonly">readonly</span>
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ <span class="summary_desc"><div class='inline'>
200
+ <p>The corresponding Resource instance.</p>
201
+ </div></span>
202
+
203
+ </li>
204
+
205
+
206
+ </ul>
207
+
208
+
209
+
210
+
211
+
212
+ <h2>
213
+ Instance Method Summary
214
+ <small><a href="#" class="summary_toggle">collapse</a></small>
215
+ </h2>
216
+
217
+ <ul class="summary">
218
+
219
+ <li class="public ">
220
+ <span class="summary_signature">
221
+
222
+ <a href="#apply-instance_method" title="#apply (instance method)">#<strong>apply</strong> &#x21d2; Object </a>
223
+
224
+
225
+
226
+ </span>
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+ <span class="summary_desc"><div class='inline'>
237
+ <p>Apply this scoping criteria.</p>
238
+ </div></span>
239
+
240
+ </li>
241
+
242
+
243
+ <li class="public ">
244
+ <span class="summary_signature">
245
+
246
+ <a href="#apply%3F-instance_method" title="#apply? (instance method)">#<strong>apply?</strong> &#x21d2; Boolean </a>
247
+
248
+
249
+
250
+ </span>
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ <span class="summary_desc"><div class='inline'>
261
+ <p>Should we process this scope logic?.</p>
262
+ </div></span>
263
+
264
+ </li>
265
+
266
+
267
+ <li class="public ">
268
+ <span class="summary_signature">
269
+
270
+ <a href="#apply_custom_scope-instance_method" title="#apply_custom_scope (instance method)">#<strong>apply_custom_scope</strong> &#x21d2; Object </a>
271
+
272
+
273
+
274
+ </span>
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+ <span class="summary_desc"><div class='inline'>
285
+ <p>Defines how to call/apply the custom scoping logic provided by the user.</p>
286
+ </div></span>
287
+
288
+ </li>
289
+
290
+
291
+ <li class="public ">
292
+ <span class="summary_signature">
293
+
294
+ <a href="#apply_standard_scope-instance_method" title="#apply_standard_scope (instance method)">#<strong>apply_standard_scope</strong> &#x21d2; Object </a>
295
+
296
+
297
+
298
+ </span>
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+ <span class="summary_desc"><div class='inline'>
309
+ <p>Defines how to call/apply the default scoping logic.</p>
310
+ </div></span>
311
+
312
+ </li>
313
+
314
+
315
+ <li class="public ">
316
+ <span class="summary_signature">
317
+
318
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(resource, query_hash, scope, opts = {}) &#x21d2; Base </a>
319
+
320
+
321
+
322
+ </span>
323
+
324
+
325
+ <span class="note title constructor">constructor</span>
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+ <span class="summary_desc"><div class='inline'>
335
+ <p>A new instance of Base.</p>
336
+ </div></span>
337
+
338
+ </li>
339
+
340
+
341
+ </ul>
342
+
343
+
344
+ <div id="constructor_details" class="method_details_list">
345
+ <h2>Constructor Details</h2>
346
+
347
+ <div class="method_details first">
348
+ <h3 class="signature first" id="initialize-instance_method">
349
+
350
+ #<strong>initialize</strong>(resource, query_hash, scope, opts = {}) &#x21d2; <tt><span class='object_link'><a href="" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></tt>
351
+
352
+
353
+
354
+
355
+
356
+ </h3><div class="docstring">
357
+ <div class="discussion">
358
+
359
+ <p>Returns a new instance of Base</p>
360
+
361
+
362
+ </div>
363
+ </div>
364
+ <div class="tags">
365
+ <p class="tag_title">Parameters:</p>
366
+ <ul class="param">
367
+
368
+ <li>
369
+
370
+ <span class='name'>resource</span>
371
+
372
+
373
+ <span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt>)</span>
374
+
375
+
376
+
377
+ &mdash;
378
+ <div class='inline'>
379
+ <p>the Resource instance</p>
380
+ </div>
381
+
382
+ </li>
383
+
384
+ <li>
385
+
386
+ <span class='name'>query_hash</span>
387
+
388
+
389
+ <span class='type'>(<tt>Hash</tt>)</span>
390
+
391
+
392
+
393
+ &mdash;
394
+ <div class='inline'>
395
+ <p>the Query#to_hash node relevant to the current resource</p>
396
+ </div>
397
+
398
+ </li>
399
+
400
+ <li>
401
+
402
+ <span class='name'>scope</span>
403
+
404
+
405
+ <span class='type'></span>
406
+
407
+
408
+
409
+ &mdash;
410
+ <div class='inline'>
411
+ <p>the base scope object to chain/modify</p>
412
+ </div>
413
+
414
+ </li>
415
+
416
+ <li>
417
+
418
+ <span class='name'>opts</span>
419
+
420
+
421
+ <span class='type'>(<tt>Hash</tt>)</span>
422
+
423
+
424
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
425
+
426
+
427
+ &mdash;
428
+ <div class='inline'>
429
+ <p>configuration options used by subclasses</p>
430
+ </div>
431
+
432
+ </li>
433
+
434
+ </ul>
435
+
436
+
437
+ </div><table class="source_code">
438
+ <tr>
439
+ <td>
440
+ <pre class="lines">
441
+
442
+
443
+ 26
444
+ 27
445
+ 28
446
+ 29
447
+ 30
448
+ 31</pre>
449
+ </td>
450
+ <td>
451
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 26</span>
452
+
453
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_resource'>resource</span><span class='comma'>,</span> <span class='id identifier rubyid_query_hash'>query_hash</span><span class='comma'>,</span> <span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
454
+ <span class='ivar'>@query_hash</span> <span class='op'>=</span> <span class='id identifier rubyid_query_hash'>query_hash</span>
455
+ <span class='ivar'>@resource</span> <span class='op'>=</span> <span class='id identifier rubyid_resource'>resource</span>
456
+ <span class='ivar'>@scope</span> <span class='op'>=</span> <span class='id identifier rubyid_scope'>scope</span>
457
+ <span class='ivar'>@opts</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span>
458
+ <span class='kw'>end</span></pre>
459
+ </td>
460
+ </tr>
461
+ </table>
462
+ </div>
463
+
464
+ </div>
465
+
466
+ <div id="instance_attr_details" class="attr_details">
467
+ <h2>Instance Attribute Details</h2>
468
+
469
+
470
+ <span id=""></span>
471
+ <div class="method_details first">
472
+ <h3 class="signature first" id="query_hash-instance_method">
473
+
474
+ #<strong>query_hash</strong> &#x21d2; <tt>Hash</tt> <span class="extras">(readonly)</span>
475
+
476
+
477
+
478
+
479
+
480
+ </h3><div class="docstring">
481
+ <div class="discussion">
482
+
483
+ <p>the Query#to_hash node relevant to the current resource</p>
484
+
485
+
486
+ </div>
487
+ </div>
488
+ <div class="tags">
489
+
490
+ <p class="tag_title">Returns:</p>
491
+ <ul class="return">
492
+
493
+ <li>
494
+
495
+
496
+ <span class='type'>(<tt>Hash</tt>)</span>
497
+
498
+
499
+
500
+ &mdash;
501
+ <div class='inline'>
502
+ <p>the current value of query_hash</p>
503
+ </div>
504
+
505
+ </li>
506
+
507
+ </ul>
508
+
509
+ </div><table class="source_code">
510
+ <tr>
511
+ <td>
512
+ <pre class="lines">
513
+
514
+
515
+ 19
516
+ 20
517
+ 21</pre>
518
+ </td>
519
+ <td>
520
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 19</span>
521
+
522
+ <span class='kw'>def</span> <span class='id identifier rubyid_query_hash'>query_hash</span>
523
+ <span class='ivar'>@query_hash</span>
524
+ <span class='kw'>end</span></pre>
525
+ </td>
526
+ </tr>
527
+ </table>
528
+ </div>
529
+
530
+
531
+ <span id=""></span>
532
+ <div class="method_details ">
533
+ <h3 class="signature " id="resource-instance_method">
534
+
535
+ #<strong>resource</strong> &#x21d2; <tt><span class='object_link'><a href="../Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt> <span class="extras">(readonly)</span>
536
+
537
+
538
+
539
+
540
+
541
+ </h3><div class="docstring">
542
+ <div class="discussion">
543
+
544
+ <p>The corresponding Resource instance</p>
545
+
546
+
547
+ </div>
548
+ </div>
549
+ <div class="tags">
550
+
551
+ <p class="tag_title">Returns:</p>
552
+ <ul class="return">
553
+
554
+ <li>
555
+
556
+
557
+ <span class='type'>(<tt><span class='object_link'><a href="../Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt>)</span>
558
+
559
+
560
+
561
+ &mdash;
562
+ <div class='inline'>
563
+ <p>the current value of resource</p>
564
+ </div>
565
+
566
+ </li>
567
+
568
+ </ul>
569
+
570
+ </div><table class="source_code">
571
+ <tr>
572
+ <td>
573
+ <pre class="lines">
574
+
575
+
576
+ 19
577
+ 20
578
+ 21</pre>
579
+ </td>
580
+ <td>
581
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 19</span>
582
+
583
+ <span class='kw'>def</span> <span class='id identifier rubyid_resource'>resource</span>
584
+ <span class='ivar'>@resource</span>
585
+ <span class='kw'>end</span></pre>
586
+ </td>
587
+ </tr>
588
+ </table>
589
+ </div>
590
+
591
+ </div>
592
+
593
+
594
+ <div id="instance_method_details" class="method_details_list">
595
+ <h2>Instance Method Details</h2>
596
+
597
+
598
+ <div class="method_details first">
599
+ <h3 class="signature first" id="apply-instance_method">
600
+
601
+ #<strong>apply</strong> &#x21d2; <tt>Object</tt>
602
+
603
+
604
+
605
+
606
+
607
+ </h3><div class="docstring">
608
+ <div class="discussion">
609
+
610
+ <p>Apply this scoping criteria. This is where we would chain on pagination,
611
+ sorting, etc.</p>
612
+
613
+ <p>If #apply? returns false, does nothing. Otherwise will apply the default
614
+ logic:</p>
615
+
616
+ <pre class="code ruby"><code class="ruby"><span class='comment'># no block, run default logic via adapter
617
+ </span><span class='id identifier rubyid_allow_filter'>allow_filter</span> <span class='symbol'>:name</span>
618
+ </code></pre>
619
+
620
+ <p>Or the customized proc:</p>
621
+
622
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_allow_filter'>allow_filter</span> <span class='symbol'>:name</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
623
+ <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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>upper(name) = ?</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='rparen'>)</span>
624
+ <span class='kw'>end</span>
625
+ </code></pre>
626
+
627
+
628
+ </div>
629
+ </div>
630
+ <div class="tags">
631
+
632
+ <p class="tag_title">Returns:</p>
633
+ <ul class="return">
634
+
635
+ <li>
636
+
637
+
638
+ <span class='type'></span>
639
+
640
+
641
+
642
+
643
+ <div class='inline'>
644
+ <p>the scope object</p>
645
+ </div>
646
+
647
+ </li>
648
+
649
+ </ul>
650
+
651
+ <p class="tag_title">See Also:</p>
652
+ <ul class="see">
653
+
654
+ <li><span class='object_link'><a href="#apply%3F-instance_method" title="JsonapiCompliable::Scoping::Base#apply? (method)">#apply?</a></span></li>
655
+
656
+ </ul>
657
+
658
+ </div><table class="source_code">
659
+ <tr>
660
+ <td>
661
+ <pre class="lines">
662
+
663
+
664
+ 50
665
+ 51
666
+ 52
667
+ 53
668
+ 54
669
+ 55
670
+ 56</pre>
671
+ </td>
672
+ <td>
673
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 50</span>
674
+
675
+ <span class='kw'>def</span> <span class='id identifier rubyid_apply'>apply</span>
676
+ <span class='kw'>if</span> <span class='id identifier rubyid_apply?'>apply?</span>
677
+ <span class='id identifier rubyid_apply_standard_or_override'>apply_standard_or_override</span>
678
+ <span class='kw'>else</span>
679
+ <span class='ivar'>@scope</span>
680
+ <span class='kw'>end</span>
681
+ <span class='kw'>end</span></pre>
682
+ </td>
683
+ </tr>
684
+ </table>
685
+ </div>
686
+
687
+ <div class="method_details ">
688
+ <h3 class="signature " id="apply?-instance_method">
689
+
690
+ #<strong>apply?</strong> &#x21d2; <tt>Boolean</tt>
691
+
692
+
693
+
694
+
695
+
696
+ </h3><div class="docstring">
697
+ <div class="discussion">
698
+
699
+ <p>Should we process this scope logic?</p>
700
+
701
+ <p>Useful for when we want to explicitly opt-out on certain requests, or avoid
702
+ a default in certain contexts.</p>
703
+
704
+
705
+ </div>
706
+ </div>
707
+ <div class="tags">
708
+
709
+ <p class="tag_title">Returns:</p>
710
+ <ul class="return">
711
+
712
+ <li>
713
+
714
+
715
+ <span class='type'>(<tt>Boolean</tt>)</span>
716
+
717
+
718
+
719
+ &mdash;
720
+ <div class='inline'>
721
+ <p>if we should apply this scope logic</p>
722
+ </div>
723
+
724
+ </li>
725
+
726
+ </ul>
727
+
728
+ </div><table class="source_code">
729
+ <tr>
730
+ <td>
731
+ <pre class="lines">
732
+
733
+
734
+ 64
735
+ 65
736
+ 66</pre>
737
+ </td>
738
+ <td>
739
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 64</span>
740
+
741
+ <span class='kw'>def</span> <span class='id identifier rubyid_apply?'>apply?</span>
742
+ <span class='kw'>true</span>
743
+ <span class='kw'>end</span></pre>
744
+ </td>
745
+ </tr>
746
+ </table>
747
+ </div>
748
+
749
+ <div class="method_details ">
750
+ <h3 class="signature " id="apply_custom_scope-instance_method">
751
+
752
+ #<strong>apply_custom_scope</strong> &#x21d2; <tt>Object</tt>
753
+
754
+
755
+
756
+
757
+
758
+ </h3><div class="docstring">
759
+ <div class="discussion">
760
+
761
+ <p>Defines how to call/apply the custom scoping logic provided by the user.</p>
762
+
763
+
764
+ </div>
765
+ </div>
766
+ <div class="tags">
767
+
768
+
769
+ </div><table class="source_code">
770
+ <tr>
771
+ <td>
772
+ <pre class="lines">
773
+
774
+
775
+ 75
776
+ 76
777
+ 77</pre>
778
+ </td>
779
+ <td>
780
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 75</span>
781
+
782
+ <span class='kw'>def</span> <span class='id identifier rubyid_apply_custom_scope'>apply_custom_scope</span>
783
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>override in subclass</span><span class='tstring_end'>&#39;</span></span>
784
+ <span class='kw'>end</span></pre>
785
+ </td>
786
+ </tr>
787
+ </table>
788
+ </div>
789
+
790
+ <div class="method_details ">
791
+ <h3 class="signature " id="apply_standard_scope-instance_method">
792
+
793
+ #<strong>apply_standard_scope</strong> &#x21d2; <tt>Object</tt>
794
+
795
+
796
+
797
+
798
+
799
+ </h3><div class="docstring">
800
+ <div class="discussion">
801
+
802
+ <p>Defines how to call/apply the default scoping logic</p>
803
+
804
+
805
+ </div>
806
+ </div>
807
+ <div class="tags">
808
+
809
+
810
+ </div><table class="source_code">
811
+ <tr>
812
+ <td>
813
+ <pre class="lines">
814
+
815
+
816
+ 69
817
+ 70
818
+ 71</pre>
819
+ </td>
820
+ <td>
821
+ <pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/base.rb', line 69</span>
822
+
823
+ <span class='kw'>def</span> <span class='id identifier rubyid_apply_standard_scope'>apply_standard_scope</span>
824
+ <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>override in subclass</span><span class='tstring_end'>&#39;</span></span>
825
+ <span class='kw'>end</span></pre>
826
+ </td>
827
+ </tr>
828
+ </table>
829
+ </div>
830
+
831
+ </div>
832
+
833
+ </div>
834
+
835
+ <div id="footer">
836
+ Generated on Fri May 5 15:53:22 2017 by
837
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
838
+ 0.9.9 (ruby-2.3.0).
839
+ </div>
840
+
841
+ </div>
842
+ </body>
843
+ </html>