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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +11 -3
- data/.yardopts +1 -0
- data/README.md +10 -1
- data/Rakefile +1 -0
- data/docs/JsonapiCompliable.html +202 -0
- data/docs/JsonapiCompliable/Adapters.html +119 -0
- data/docs/JsonapiCompliable/Adapters/Abstract.html +2285 -0
- data/docs/JsonapiCompliable/Adapters/ActiveRecord.html +2151 -0
- data/docs/JsonapiCompliable/Adapters/ActiveRecordSideloading.html +582 -0
- data/docs/JsonapiCompliable/Adapters/Null.html +1682 -0
- data/docs/JsonapiCompliable/Base.html +1395 -0
- data/docs/JsonapiCompliable/Deserializer.html +835 -0
- data/docs/JsonapiCompliable/Errors.html +115 -0
- data/docs/JsonapiCompliable/Errors/BadFilter.html +124 -0
- data/docs/JsonapiCompliable/Errors/StatNotFound.html +266 -0
- data/docs/JsonapiCompliable/Errors/UnsupportedPageSize.html +264 -0
- data/docs/JsonapiCompliable/Errors/ValidationError.html +124 -0
- data/docs/JsonapiCompliable/Extensions.html +117 -0
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute.html +212 -0
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute/ClassMethods.html +229 -0
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute.html +242 -0
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute/ClassMethods.html +237 -0
- data/docs/JsonapiCompliable/Query.html +1099 -0
- data/docs/JsonapiCompliable/Rails.html +211 -0
- data/docs/JsonapiCompliable/Resource.html +5241 -0
- data/docs/JsonapiCompliable/Scope.html +703 -0
- data/docs/JsonapiCompliable/Scoping.html +117 -0
- data/docs/JsonapiCompliable/Scoping/Base.html +843 -0
- data/docs/JsonapiCompliable/Scoping/DefaultFilter.html +318 -0
- data/docs/JsonapiCompliable/Scoping/ExtraFields.html +301 -0
- data/docs/JsonapiCompliable/Scoping/Filter.html +313 -0
- data/docs/JsonapiCompliable/Scoping/Filterable.html +364 -0
- data/docs/JsonapiCompliable/Scoping/Paginate.html +613 -0
- data/docs/JsonapiCompliable/Scoping/Sort.html +454 -0
- data/docs/JsonapiCompliable/SerializableTempId.html +216 -0
- data/docs/JsonapiCompliable/Sideload.html +2484 -0
- data/docs/JsonapiCompliable/Stats.html +117 -0
- data/docs/JsonapiCompliable/Stats/DSL.html +999 -0
- data/docs/JsonapiCompliable/Stats/Payload.html +391 -0
- data/docs/JsonapiCompliable/Util.html +117 -0
- data/docs/JsonapiCompliable/Util/FieldParams.html +228 -0
- data/docs/JsonapiCompliable/Util/Hash.html +471 -0
- data/docs/JsonapiCompliable/Util/IncludeParams.html +299 -0
- data/docs/JsonapiCompliable/Util/Persistence.html +435 -0
- data/docs/JsonapiCompliable/Util/RelationshipPayload.html +563 -0
- data/docs/JsonapiCompliable/Util/RenderOptions.html +250 -0
- data/docs/JsonapiCompliable/Util/ValidationResponse.html +532 -0
- data/docs/_index.html +527 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +99 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +99 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1731 -0
- data/docs/top-level-namespace.html +110 -0
- data/gemfiles/rails_5.gemfile +1 -1
- data/lib/jsonapi_compliable/adapters/abstract.rb +267 -4
- data/lib/jsonapi_compliable/adapters/active_record.rb +23 -1
- data/lib/jsonapi_compliable/adapters/null.rb +43 -3
- data/lib/jsonapi_compliable/base.rb +182 -33
- data/lib/jsonapi_compliable/deserializer.rb +90 -21
- data/lib/jsonapi_compliable/extensions/boolean_attribute.rb +12 -0
- data/lib/jsonapi_compliable/extensions/extra_attribute.rb +32 -0
- data/lib/jsonapi_compliable/extensions/temp_id.rb +11 -0
- data/lib/jsonapi_compliable/query.rb +94 -2
- data/lib/jsonapi_compliable/rails.rb +8 -0
- data/lib/jsonapi_compliable/resource.rb +548 -11
- data/lib/jsonapi_compliable/scope.rb +43 -1
- data/lib/jsonapi_compliable/scoping/base.rb +59 -8
- data/lib/jsonapi_compliable/scoping/default_filter.rb +33 -0
- data/lib/jsonapi_compliable/scoping/extra_fields.rb +33 -0
- data/lib/jsonapi_compliable/scoping/filter.rb +29 -2
- data/lib/jsonapi_compliable/scoping/filterable.rb +4 -0
- data/lib/jsonapi_compliable/scoping/paginate.rb +33 -0
- data/lib/jsonapi_compliable/scoping/sort.rb +18 -0
- data/lib/jsonapi_compliable/sideload.rb +229 -1
- data/lib/jsonapi_compliable/stats/dsl.rb +44 -0
- data/lib/jsonapi_compliable/stats/payload.rb +20 -0
- data/lib/jsonapi_compliable/util/field_params.rb +1 -0
- data/lib/jsonapi_compliable/util/hash.rb +18 -0
- data/lib/jsonapi_compliable/util/include_params.rb +22 -0
- data/lib/jsonapi_compliable/util/persistence.rb +13 -3
- data/lib/jsonapi_compliable/util/relationship_payload.rb +2 -0
- data/lib/jsonapi_compliable/util/render_options.rb +2 -0
- data/lib/jsonapi_compliable/util/validation_response.rb +16 -0
- data/lib/jsonapi_compliable/version.rb +1 -1
- metadata +60 -5
- data/gemfiles/rails_4.gemfile.lock +0 -208
- data/gemfiles/rails_5.gemfile.lock +0 -212
- data/lib/jsonapi_compliable/write.rb +0 -93
@@ -0,0 +1,613 @@
|
|
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::Paginate
|
8
|
+
|
9
|
+
— 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::Paginate";
|
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 (P)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> » <span class='title'><span class='object_link'><a href="../Scoping.html" title="JsonapiCompliable::Scoping (module)">Scoping</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Paginate</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::Paginate
|
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="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">JsonapiCompliable::Scoping::Paginate</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/scoping/paginate.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Apply pagination logic to the scope</p>
|
108
|
+
|
109
|
+
<p>If the user requests a page size greater than <code>MAX_PAGE_SIZE</code>, a
|
110
|
+
<code>JsonapiCompliable::Errors::UnsupportedPageSize</code> error will be
|
111
|
+
raised.</p>
|
112
|
+
|
113
|
+
<p>Notably, this will not fire when the `default: false` option is passed.
|
114
|
+
This is the case for sideloads - if the user requests “give me the post and
|
115
|
+
its comments”, we shouldn't implicitly limit those comments to 20.
|
116
|
+
<strong>BUT</strong> if the user requests, “give me the post and 3 of its
|
117
|
+
comments”, we <strong>should</strong> honor that pagination.</p>
|
118
|
+
|
119
|
+
<p>This can be confusing because there are also 'default' and
|
120
|
+
'customized' pagination procs. The default comes 'for
|
121
|
+
free'. Customized pagination looks like</p>
|
122
|
+
|
123
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>PostResource</span> <span class='op'><</span> <span class='const'>ApplicationResource</span>
|
124
|
+
<span class='id identifier rubyid_paginate'>paginate</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_current_page'>current_page</span><span class='comma'>,</span> <span class='id identifier rubyid_per_page'>per_page</span><span class='op'>|</span>
|
125
|
+
<span class='comment'># ... the custom logic ...
|
126
|
+
</span> <span class='kw'>end</span>
|
127
|
+
<span class='kw'>end</span>
|
128
|
+
</code></pre>
|
129
|
+
|
130
|
+
<p>We should use the default unless the user has customized.</p>
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
<div class="tags">
|
136
|
+
|
137
|
+
|
138
|
+
<p class="tag_title">See Also:</p>
|
139
|
+
<ul class="see">
|
140
|
+
|
141
|
+
<li><span class='object_link'><a href="../Resource.html#paginate-class_method" title="JsonapiCompliable::Resource.paginate (method)">Resource.paginate</a></span></li>
|
142
|
+
|
143
|
+
</ul>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
<h2>Constant Summary</h2>
|
147
|
+
<dl class="constants">
|
148
|
+
|
149
|
+
<dt id="MAX_PAGE_SIZE-constant" class="">MAX_PAGE_SIZE =
|
150
|
+
|
151
|
+
</dt>
|
152
|
+
<dd><pre class="code"><span class='int'>1_000</span></pre></dd>
|
153
|
+
|
154
|
+
</dl>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<h2>Instance Attribute Summary</h2>
|
162
|
+
|
163
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></h3>
|
164
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#query_hash-instance_method" title="JsonapiCompliable::Scoping::Base#query_hash (method)">#query_hash</a></span>, <span class='object_link'><a href="Base.html#resource-instance_method" title="JsonapiCompliable::Scoping::Base#resource (method)">#resource</a></span></p>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<h2>
|
169
|
+
Instance Method Summary
|
170
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
171
|
+
</h2>
|
172
|
+
|
173
|
+
<ul class="summary">
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#apply-instance_method" title="#apply (instance method)">#<strong>apply</strong> ⇒ Object </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="summary_desc"><div class='inline'>
|
193
|
+
<p>Apply the pagination logic.</p>
|
194
|
+
</div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li class="public ">
|
200
|
+
<span class="summary_signature">
|
201
|
+
|
202
|
+
<a href="#apply%3F-instance_method" title="#apply? (instance method)">#<strong>apply?</strong> ⇒ Boolean </a>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<span class="summary_desc"><div class='inline'>
|
217
|
+
<p>We want to apply this logic unless we've explicitly received the
|
218
|
+
<tt>default: false</tt> option.</p>
|
219
|
+
</div></span>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
<li class="public ">
|
225
|
+
<span class="summary_signature">
|
226
|
+
|
227
|
+
<a href="#apply_custom_scope-instance_method" title="#apply_custom_scope (instance method)">#<strong>apply_custom_scope</strong> ⇒ Object </a>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</span>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'>
|
242
|
+
<p>Apply the custom pagination proc.</p>
|
243
|
+
</div></span>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
|
248
|
+
<li class="public ">
|
249
|
+
<span class="summary_signature">
|
250
|
+
|
251
|
+
<a href="#apply_standard_scope-instance_method" title="#apply_standard_scope (instance method)">#<strong>apply_standard_scope</strong> ⇒ Object </a>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</span>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<span class="summary_desc"><div class='inline'>
|
266
|
+
<p>Apply default pagination proc via the Resource adapter.</p>
|
267
|
+
</div></span>
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
|
272
|
+
<li class="public ">
|
273
|
+
<span class="summary_signature">
|
274
|
+
|
275
|
+
<a href="#custom_scope-instance_method" title="#custom_scope (instance method)">#<strong>custom_scope</strong> ⇒ Proc, Nil </a>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
</span>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<span class="summary_desc"><div class='inline'>
|
290
|
+
<p>The custom pagination proc.</p>
|
291
|
+
</div></span>
|
292
|
+
|
293
|
+
</li>
|
294
|
+
|
295
|
+
|
296
|
+
</ul>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></h3>
|
309
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#initialize-instance_method" title="JsonapiCompliable::Scoping::Base#initialize (method)">#initialize</a></span></p>
|
310
|
+
<div id="constructor_details" class="method_details_list">
|
311
|
+
<h2>Constructor Details</h2>
|
312
|
+
|
313
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Base.html#initialize-instance_method" title="JsonapiCompliable::Scoping::Base#initialize (method)">JsonapiCompliable::Scoping::Base</a></span></p>
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
|
318
|
+
<div id="instance_method_details" class="method_details_list">
|
319
|
+
<h2>Instance Method Details</h2>
|
320
|
+
|
321
|
+
|
322
|
+
<div class="method_details first">
|
323
|
+
<h3 class="signature first" id="apply-instance_method">
|
324
|
+
|
325
|
+
#<strong>apply</strong> ⇒ <tt>Object</tt>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
</h3><div class="docstring">
|
332
|
+
<div class="discussion">
|
333
|
+
|
334
|
+
<p>Apply the pagination logic. Raise error if over the max page size.</p>
|
335
|
+
|
336
|
+
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
<div class="tags">
|
340
|
+
|
341
|
+
<p class="tag_title">Returns:</p>
|
342
|
+
<ul class="return">
|
343
|
+
|
344
|
+
<li>
|
345
|
+
|
346
|
+
|
347
|
+
<span class='type'></span>
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<div class='inline'>
|
353
|
+
<p>the scope object we are chaining/modifying</p>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
</li>
|
357
|
+
|
358
|
+
</ul>
|
359
|
+
|
360
|
+
</div><table class="source_code">
|
361
|
+
<tr>
|
362
|
+
<td>
|
363
|
+
<pre class="lines">
|
364
|
+
|
365
|
+
|
366
|
+
30
|
367
|
+
31
|
368
|
+
32
|
369
|
+
33
|
370
|
+
34
|
371
|
+
35
|
372
|
+
36
|
373
|
+
37</pre>
|
374
|
+
</td>
|
375
|
+
<td>
|
376
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/paginate.rb', line 30</span>
|
377
|
+
|
378
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_apply'>apply</span>
|
379
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_size'>size</span> <span class='op'>></span> <span class='const'><span class='object_link'><a href="#MAX_PAGE_SIZE-constant" title="JsonapiCompliable::Scoping::Paginate::MAX_PAGE_SIZE (constant)">MAX_PAGE_SIZE</a></span></span>
|
380
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors.html" title="JsonapiCompliable::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors/UnsupportedPageSize.html" title="JsonapiCompliable::Errors::UnsupportedPageSize (class)">UnsupportedPageSize</a></span></span>
|
381
|
+
<span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#MAX_PAGE_SIZE-constant" title="JsonapiCompliable::Scoping::Paginate::MAX_PAGE_SIZE (constant)">MAX_PAGE_SIZE</a></span></span><span class='rparen'>)</span>
|
382
|
+
<span class='kw'>else</span>
|
383
|
+
<span class='kw'>super</span>
|
384
|
+
<span class='kw'>end</span>
|
385
|
+
<span class='kw'>end</span></pre>
|
386
|
+
</td>
|
387
|
+
</tr>
|
388
|
+
</table>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
<div class="method_details ">
|
392
|
+
<h3 class="signature " id="apply?-instance_method">
|
393
|
+
|
394
|
+
#<strong>apply?</strong> ⇒ <tt>Boolean</tt>
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
</h3><div class="docstring">
|
401
|
+
<div class="discussion">
|
402
|
+
|
403
|
+
<p>We want to apply this logic unless we've explicitly received the
|
404
|
+
<tt>default: false</tt> option. In that case, only apply if pagination was
|
405
|
+
explicitly specified in the request.</p>
|
406
|
+
|
407
|
+
|
408
|
+
</div>
|
409
|
+
</div>
|
410
|
+
<div class="tags">
|
411
|
+
|
412
|
+
<p class="tag_title">Returns:</p>
|
413
|
+
<ul class="return">
|
414
|
+
|
415
|
+
<li>
|
416
|
+
|
417
|
+
|
418
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
—
|
423
|
+
<div class='inline'>
|
424
|
+
<p>should we apply this logic?</p>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
</li>
|
428
|
+
|
429
|
+
</ul>
|
430
|
+
|
431
|
+
</div><table class="source_code">
|
432
|
+
<tr>
|
433
|
+
<td>
|
434
|
+
<pre class="lines">
|
435
|
+
|
436
|
+
|
437
|
+
44
|
438
|
+
45
|
439
|
+
46
|
440
|
+
47
|
441
|
+
48
|
442
|
+
49
|
443
|
+
50</pre>
|
444
|
+
</td>
|
445
|
+
<td>
|
446
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/paginate.rb', line 44</span>
|
447
|
+
|
448
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_apply?'>apply?</span>
|
449
|
+
<span class='kw'>if</span> <span class='ivar'>@opts</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>false</span>
|
450
|
+
<span class='kw'>not</span> <span class='lbracket'>[</span><span class='id identifier rubyid_page_param'>page_param</span><span class='lbracket'>[</span><span class='symbol'>:size</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_page_param'>page_param</span><span class='lbracket'>[</span><span class='symbol'>:number</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:nil?</span><span class='rparen'>)</span>
|
451
|
+
<span class='kw'>else</span>
|
452
|
+
<span class='kw'>true</span>
|
453
|
+
<span class='kw'>end</span>
|
454
|
+
<span class='kw'>end</span></pre>
|
455
|
+
</td>
|
456
|
+
</tr>
|
457
|
+
</table>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
<div class="method_details ">
|
461
|
+
<h3 class="signature " id="apply_custom_scope-instance_method">
|
462
|
+
|
463
|
+
#<strong>apply_custom_scope</strong> ⇒ <tt>Object</tt>
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
</h3><div class="docstring">
|
470
|
+
<div class="discussion">
|
471
|
+
|
472
|
+
<p>Apply the custom pagination proc</p>
|
473
|
+
|
474
|
+
|
475
|
+
</div>
|
476
|
+
</div>
|
477
|
+
<div class="tags">
|
478
|
+
|
479
|
+
|
480
|
+
</div><table class="source_code">
|
481
|
+
<tr>
|
482
|
+
<td>
|
483
|
+
<pre class="lines">
|
484
|
+
|
485
|
+
|
486
|
+
63
|
487
|
+
64
|
488
|
+
65</pre>
|
489
|
+
</td>
|
490
|
+
<td>
|
491
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/paginate.rb', line 63</span>
|
492
|
+
|
493
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_apply_custom_scope'>apply_custom_scope</span>
|
494
|
+
<span class='id identifier rubyid_custom_scope'>custom_scope</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='ivar'>@scope</span><span class='comma'>,</span> <span class='id identifier rubyid_number'>number</span><span class='comma'>,</span> <span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span>
|
495
|
+
<span class='kw'>end</span></pre>
|
496
|
+
</td>
|
497
|
+
</tr>
|
498
|
+
</table>
|
499
|
+
</div>
|
500
|
+
|
501
|
+
<div class="method_details ">
|
502
|
+
<h3 class="signature " id="apply_standard_scope-instance_method">
|
503
|
+
|
504
|
+
#<strong>apply_standard_scope</strong> ⇒ <tt>Object</tt>
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</h3><div class="docstring">
|
511
|
+
<div class="discussion">
|
512
|
+
|
513
|
+
<p>Apply default pagination proc via the Resource adapter</p>
|
514
|
+
|
515
|
+
|
516
|
+
</div>
|
517
|
+
</div>
|
518
|
+
<div class="tags">
|
519
|
+
|
520
|
+
|
521
|
+
</div><table class="source_code">
|
522
|
+
<tr>
|
523
|
+
<td>
|
524
|
+
<pre class="lines">
|
525
|
+
|
526
|
+
|
527
|
+
58
|
528
|
+
59
|
529
|
+
60</pre>
|
530
|
+
</td>
|
531
|
+
<td>
|
532
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/paginate.rb', line 58</span>
|
533
|
+
|
534
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_apply_standard_scope'>apply_standard_scope</span>
|
535
|
+
<span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_adapter'>adapter</span><span class='period'>.</span><span class='id identifier rubyid_paginate'>paginate</span><span class='lparen'>(</span><span class='ivar'>@scope</span><span class='comma'>,</span> <span class='id identifier rubyid_number'>number</span><span class='comma'>,</span> <span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span>
|
536
|
+
<span class='kw'>end</span></pre>
|
537
|
+
</td>
|
538
|
+
</tr>
|
539
|
+
</table>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
<div class="method_details ">
|
543
|
+
<h3 class="signature " id="custom_scope-instance_method">
|
544
|
+
|
545
|
+
#<strong>custom_scope</strong> ⇒ <tt>Proc</tt>, <tt>Nil</tt>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
</h3><div class="docstring">
|
552
|
+
<div class="discussion">
|
553
|
+
|
554
|
+
<p>Returns the custom pagination proc</p>
|
555
|
+
|
556
|
+
|
557
|
+
</div>
|
558
|
+
</div>
|
559
|
+
<div class="tags">
|
560
|
+
|
561
|
+
<p class="tag_title">Returns:</p>
|
562
|
+
<ul class="return">
|
563
|
+
|
564
|
+
<li>
|
565
|
+
|
566
|
+
|
567
|
+
<span class='type'>(<tt>Proc</tt>, <tt>Nil</tt>)</span>
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
—
|
572
|
+
<div class='inline'>
|
573
|
+
<p>the custom pagination proc</p>
|
574
|
+
</div>
|
575
|
+
|
576
|
+
</li>
|
577
|
+
|
578
|
+
</ul>
|
579
|
+
|
580
|
+
</div><table class="source_code">
|
581
|
+
<tr>
|
582
|
+
<td>
|
583
|
+
<pre class="lines">
|
584
|
+
|
585
|
+
|
586
|
+
53
|
587
|
+
54
|
588
|
+
55</pre>
|
589
|
+
</td>
|
590
|
+
<td>
|
591
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/paginate.rb', line 53</span>
|
592
|
+
|
593
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_custom_scope'>custom_scope</span>
|
594
|
+
<span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_pagination'>pagination</span>
|
595
|
+
<span class='kw'>end</span></pre>
|
596
|
+
</td>
|
597
|
+
</tr>
|
598
|
+
</table>
|
599
|
+
</div>
|
600
|
+
|
601
|
+
</div>
|
602
|
+
|
603
|
+
</div>
|
604
|
+
|
605
|
+
<div id="footer">
|
606
|
+
Generated on Fri May 5 15:53:23 2017 by
|
607
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
608
|
+
0.9.9 (ruby-2.3.0).
|
609
|
+
</div>
|
610
|
+
|
611
|
+
</div>
|
612
|
+
</body>
|
613
|
+
</html>
|