ballast 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -1
- data/.travis-gemfile +2 -2
- data/.travis.yml +5 -3
- data/.yardopts +1 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/LICENSE.md +21 -0
- data/README.md +22 -17
- data/Rakefile +1 -1
- data/ballast.gemspec +1 -1
- data/{doc → docs}/Ballast.html +19 -21
- data/docs/Ballast/AjaxResponse.html +1470 -0
- data/{doc → docs}/Ballast/Concerns.html +3 -3
- data/{doc → docs}/Ballast/Concerns/AjaxHandling.html +33 -38
- data/{doc → docs}/Ballast/Concerns/Common.html +45 -52
- data/{doc → docs}/Ballast/Concerns/ErrorsHandling.html +13 -14
- data/docs/Ballast/Concerns/JSONApi.html +127 -0
- data/docs/Ballast/Concerns/JSONApi/PaginationHandling.html +617 -0
- data/docs/Ballast/Concerns/JSONApi/RequestHandling.html +775 -0
- data/docs/Ballast/Concerns/JSONApi/ResponseHandling.html +917 -0
- data/{doc → docs}/Ballast/Concerns/View.html +35 -42
- data/{doc → docs}/Ballast/Configuration.html +19 -22
- data/{doc → docs}/Ballast/Emoji.html +1 -1
- data/{doc → docs}/Ballast/Emoji/Character.html +15 -18
- data/docs/Ballast/Emoji/Utils.html +794 -0
- data/{doc → docs}/Ballast/Errors.html +1 -1
- data/{doc → docs}/Ballast/Errors/Base.html +16 -18
- data/{doc → docs}/Ballast/Errors/Failure.html +1 -1
- data/{doc → docs}/Ballast/Errors/InvalidDomain.html +1 -1
- data/{doc → docs}/Ballast/Errors/ValidationFailure.html +1 -1
- data/{doc → docs}/Ballast/Middlewares.html +1 -1
- data/{doc → docs}/Ballast/Middlewares/DefaultHost.html +16 -18
- data/docs/Ballast/RequestDomainMatcher.html +917 -0
- data/docs/Ballast/Service.html +1513 -0
- data/docs/Ballast/Service/Response.html +1270 -0
- data/{doc → docs}/Ballast/Version.html +5 -9
- data/{doc → docs}/_index.html +45 -1
- data/docs/class_list.html +58 -0
- data/{doc → docs}/css/common.css +0 -0
- data/{doc → docs}/css/full_list.css +0 -0
- data/{doc → docs}/css/style.css +0 -0
- data/{doc → docs}/file.README.html +7 -5
- data/{doc → docs}/file_list.html +0 -0
- data/{doc → docs}/frames.html +0 -0
- data/{doc → docs}/index.html +7 -5
- data/{doc → docs}/js/app.js +0 -0
- data/{doc → docs}/js/full_list.js +0 -0
- data/{doc → docs}/js/jquery.js +0 -0
- data/{doc → docs}/method_list.html +150 -36
- data/docs/top-level-namespace.html +149 -0
- data/lib/ballast.rb +1 -1
- data/lib/ballast/ajax_response.rb +1 -1
- data/lib/ballast/concerns/ajax_handling.rb +1 -1
- data/lib/ballast/concerns/common.rb +1 -1
- data/lib/ballast/concerns/errors_handling.rb +1 -1
- data/lib/ballast/concerns/json_api/pagination_handling.rb +83 -0
- data/lib/ballast/concerns/json_api/request_handling.rb +235 -0
- data/lib/ballast/concerns/json_api/response_handling.rb +70 -0
- data/lib/ballast/concerns/view.rb +1 -1
- data/lib/ballast/configuration.rb +1 -1
- data/lib/ballast/emoji.rb +1 -1
- data/lib/ballast/errors.rb +1 -1
- data/lib/ballast/middlewares/default_host.rb +1 -1
- data/lib/ballast/request_domain_matcher.rb +1 -1
- data/lib/ballast/service.rb +1 -1
- data/lib/ballast/version.rb +2 -2
- data/spec/ballast/ajax_response_spec.rb +1 -1
- data/spec/ballast/concerns/ajax_handling_spec.rb +1 -1
- data/spec/ballast/concerns/common_spec.rb +1 -1
- data/spec/ballast/concerns/errors_handling_spec.rb +1 -1
- data/spec/ballast/concerns/view_spec.rb +1 -1
- data/spec/ballast/configuration_spec.rb +1 -1
- data/spec/ballast/errors_spec.rb +1 -1
- data/spec/ballast/middlewares/default_host_spec.rb +1 -1
- data/spec/ballast/request_domain_matcher_spec.rb +1 -1
- data/spec/ballast_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +47 -39
- data/doc/Ballast/AjaxResponse.html +0 -1478
- data/doc/Ballast/Emoji/Utils.html +0 -799
- data/doc/Ballast/RequestDomainMatcher.html +0 -923
- data/doc/Ballast/Service.html +0 -1522
- data/doc/Ballast/Service/Response.html +0 -1278
- data/doc/class_list.html +0 -58
- data/doc/top-level-namespace.html +0 -112
@@ -0,0 +1,617 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Ballast::Concerns::JSONApi::PaginationHandling
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
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
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../../';
|
20
|
+
framesUrl = "../../../frames.html#!Ballast/Concerns/JSONApi/PaginationHandling.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../../_index.html">Index (P)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../../Ballast.html" title="Ballast (module)">Ballast</a></span></span> » <span class='title'><span class='object_link'><a href="../../Concerns.html" title="Ballast::Concerns (module)">Concerns</a></span></span> » <span class='title'><span class='object_link'><a href="../JSONApi.html" title="Ballast::Concerns::JSONApi (module)">JSONApi</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">PaginationHandling</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Ballast::Concerns::JSONApi::PaginationHandling
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/ballast/concerns/json_api/pagination_handling.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
<p>A concern to handle errors. It requires the Ajax concern.</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<h2>
|
106
|
+
Instance Method Summary
|
107
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
108
|
+
</h2>
|
109
|
+
|
110
|
+
<ul class="summary">
|
111
|
+
|
112
|
+
<li class="public ">
|
113
|
+
<span class="summary_signature">
|
114
|
+
|
115
|
+
<a href="#paginate-instance_method" title="#paginate (instance method)">- (Object) <strong>paginate</strong>(collection, sort_field: :id, sort_order: :desc) </a>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
</span>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<span class="summary_desc"><div class='inline'><p>Paginates a collection.</p>
|
130
|
+
</div></span>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
<li class="public ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#pagination_field-instance_method" title="#pagination_field (instance method)">- (Symbol) <strong>pagination_field</strong> </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'><p>Returns the field used for pagination.</p>
|
153
|
+
</div></span>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#pagination_skip%3F-instance_method" title="#pagination_skip? (instance method)">- (Boolean) <strong>pagination_skip?</strong> </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<span class="summary_desc"><div class='inline'><p>Returns whether pagination should be skipped in templates rendering for JSON API.</p>
|
176
|
+
</div></span>
|
177
|
+
|
178
|
+
</li>
|
179
|
+
|
180
|
+
|
181
|
+
<li class="public ">
|
182
|
+
<span class="summary_signature">
|
183
|
+
|
184
|
+
<a href="#pagination_supported%3F-instance_method" title="#pagination_supported? (instance method)">- (Boolean) <strong>pagination_supported?</strong> </a>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
</span>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'><p>Returns whether pagination is supported for the current set of objects for JSON API.</p>
|
199
|
+
</div></span>
|
200
|
+
|
201
|
+
</li>
|
202
|
+
|
203
|
+
|
204
|
+
<li class="public ">
|
205
|
+
<span class="summary_signature">
|
206
|
+
|
207
|
+
<a href="#pagination_url-instance_method" title="#pagination_url (instance method)">- (String) <strong>pagination_url</strong>(key = nil) </a>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
</span>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<span class="summary_desc"><div class='inline'><p>Returns a URL to get a specific page of the current set of objects.</p>
|
222
|
+
</div></span>
|
223
|
+
|
224
|
+
</li>
|
225
|
+
|
226
|
+
|
227
|
+
</ul>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
<div id="instance_method_details" class="method_details_list">
|
233
|
+
<h2>Instance Method Details</h2>
|
234
|
+
|
235
|
+
|
236
|
+
<div class="method_details first">
|
237
|
+
<h3 class="signature first" id="paginate-instance_method">
|
238
|
+
|
239
|
+
- (<tt>Object</tt>) <strong>paginate</strong>(collection, sort_field: :id, sort_order: :desc)
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
</h3><div class="docstring">
|
246
|
+
<div class="discussion">
|
247
|
+
<p>Paginates a collection.</p>
|
248
|
+
|
249
|
+
<p>return [ActiveRecord::Relation] A paginated and sorted collection.</p>
|
250
|
+
|
251
|
+
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
<div class="tags">
|
255
|
+
<p class="tag_title">Parameters:</p>
|
256
|
+
<ul class="param">
|
257
|
+
|
258
|
+
<li>
|
259
|
+
|
260
|
+
<span class='name'>collection</span>
|
261
|
+
|
262
|
+
|
263
|
+
<span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
—
|
268
|
+
<div class='inline'><p>The collection to handle.</p>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
</li>
|
272
|
+
|
273
|
+
<li>
|
274
|
+
|
275
|
+
<span class='name'>sort_field</span>
|
276
|
+
|
277
|
+
|
278
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
—
|
283
|
+
<div class='inline'><p>The field to sort on.</p>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</li>
|
287
|
+
|
288
|
+
<li>
|
289
|
+
|
290
|
+
<span class='name'>sort_order</span>
|
291
|
+
|
292
|
+
|
293
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
—
|
298
|
+
<div class='inline'><p>The sorting order.</p>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
</li>
|
302
|
+
|
303
|
+
</ul>
|
304
|
+
|
305
|
+
|
306
|
+
</div><table class="source_code">
|
307
|
+
<tr>
|
308
|
+
<td>
|
309
|
+
<pre class="lines">
|
310
|
+
|
311
|
+
|
312
|
+
17
|
313
|
+
18
|
314
|
+
19
|
315
|
+
20
|
316
|
+
21
|
317
|
+
22
|
318
|
+
23
|
319
|
+
24
|
320
|
+
25
|
321
|
+
26
|
322
|
+
27
|
323
|
+
28
|
324
|
+
29
|
325
|
+
30
|
326
|
+
31
|
327
|
+
32
|
328
|
+
33</pre>
|
329
|
+
</td>
|
330
|
+
<td>
|
331
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/json_api/pagination_handling.rb', line 17</span>
|
332
|
+
|
333
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_paginate'>paginate</span><span class='lparen'>(</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='label'>sort_field:</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>sort_order:</span> <span class='symbol'>:desc</span><span class='rparen'>)</span>
|
334
|
+
<span class='id identifier rubyid_direction'>direction</span> <span class='op'>=</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_direction'>direction</span>
|
335
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
336
|
+
|
337
|
+
<span class='comment'># Apply the query
|
338
|
+
</span> <span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_apply_value'>apply_value</span><span class='lparen'>(</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_sort_field'>sort_field</span><span class='comma'>,</span> <span class='id identifier rubyid_sort_order'>sort_order</span><span class='rparen'>)</span>
|
339
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_limit'>limit</span><span class='lparen'>(</span><span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%s %s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_sort_field'>sort_field</span><span class='comma'>,</span> <span class='id identifier rubyid_sort_order'>sort_order</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
340
|
+
|
341
|
+
<span class='comment'># If we're fetching previous we reverse the order to make sure we fetch the results adiacents to the previous request,
|
342
|
+
</span> <span class='comment'># then we reverse results to ensure the order requested
|
343
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_direction'>direction</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>next</span><span class='tstring_end'>"</span></span>
|
344
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_reverse_order'>reverse_order</span>
|
345
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span>
|
346
|
+
<span class='kw'>end</span>
|
347
|
+
|
348
|
+
<span class='id identifier rubyid_collection'>collection</span>
|
349
|
+
<span class='kw'>end</span></pre>
|
350
|
+
</td>
|
351
|
+
</tr>
|
352
|
+
</table>
|
353
|
+
</div>
|
354
|
+
|
355
|
+
<div class="method_details ">
|
356
|
+
<h3 class="signature " id="pagination_field-instance_method">
|
357
|
+
|
358
|
+
- (<tt>Symbol</tt>) <strong>pagination_field</strong>
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</h3><div class="docstring">
|
365
|
+
<div class="discussion">
|
366
|
+
<p>Returns the field used for pagination.</p>
|
367
|
+
|
368
|
+
|
369
|
+
</div>
|
370
|
+
</div>
|
371
|
+
<div class="tags">
|
372
|
+
|
373
|
+
<p class="tag_title">Returns:</p>
|
374
|
+
<ul class="return">
|
375
|
+
|
376
|
+
<li>
|
377
|
+
|
378
|
+
|
379
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
—
|
384
|
+
<div class='inline'><p>The field used for pagination.</p>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
</li>
|
388
|
+
|
389
|
+
</ul>
|
390
|
+
|
391
|
+
</div><table class="source_code">
|
392
|
+
<tr>
|
393
|
+
<td>
|
394
|
+
<pre class="lines">
|
395
|
+
|
396
|
+
|
397
|
+
38
|
398
|
+
39
|
399
|
+
40</pre>
|
400
|
+
</td>
|
401
|
+
<td>
|
402
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/json_api/pagination_handling.rb', line 38</span>
|
403
|
+
|
404
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_field'>pagination_field</span>
|
405
|
+
<span class='ivar'>@pagination_field</span> <span class='op'>||=</span> <span class='symbol'>:id</span>
|
406
|
+
<span class='kw'>end</span></pre>
|
407
|
+
</td>
|
408
|
+
</tr>
|
409
|
+
</table>
|
410
|
+
</div>
|
411
|
+
|
412
|
+
<div class="method_details ">
|
413
|
+
<h3 class="signature " id="pagination_skip?-instance_method">
|
414
|
+
|
415
|
+
- (<tt>Boolean</tt>) <strong>pagination_skip?</strong>
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
</h3><div class="docstring">
|
422
|
+
<div class="discussion">
|
423
|
+
<p>Returns whether pagination should be skipped in templates rendering for JSON API.</p>
|
424
|
+
|
425
|
+
|
426
|
+
</div>
|
427
|
+
</div>
|
428
|
+
<div class="tags">
|
429
|
+
|
430
|
+
<p class="tag_title">Returns:</p>
|
431
|
+
<ul class="return">
|
432
|
+
|
433
|
+
<li>
|
434
|
+
|
435
|
+
|
436
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
—
|
441
|
+
<div class='inline'><p>Whether pagination should be skipped.</p>
|
442
|
+
</div>
|
443
|
+
|
444
|
+
</li>
|
445
|
+
|
446
|
+
</ul>
|
447
|
+
|
448
|
+
</div><table class="source_code">
|
449
|
+
<tr>
|
450
|
+
<td>
|
451
|
+
<pre class="lines">
|
452
|
+
|
453
|
+
|
454
|
+
45
|
455
|
+
46
|
456
|
+
47</pre>
|
457
|
+
</td>
|
458
|
+
<td>
|
459
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/json_api/pagination_handling.rb', line 45</span>
|
460
|
+
|
461
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_skip?'>pagination_skip?</span>
|
462
|
+
<span class='ivar'>@skip_pagination</span>
|
463
|
+
<span class='kw'>end</span></pre>
|
464
|
+
</td>
|
465
|
+
</tr>
|
466
|
+
</table>
|
467
|
+
</div>
|
468
|
+
|
469
|
+
<div class="method_details ">
|
470
|
+
<h3 class="signature " id="pagination_supported?-instance_method">
|
471
|
+
|
472
|
+
- (<tt>Boolean</tt>) <strong>pagination_supported?</strong>
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
</h3><div class="docstring">
|
479
|
+
<div class="discussion">
|
480
|
+
<p>Returns whether pagination is supported for the current set of objects for JSON API.</p>
|
481
|
+
|
482
|
+
|
483
|
+
</div>
|
484
|
+
</div>
|
485
|
+
<div class="tags">
|
486
|
+
|
487
|
+
<p class="tag_title">Returns:</p>
|
488
|
+
<ul class="return">
|
489
|
+
|
490
|
+
<li>
|
491
|
+
|
492
|
+
|
493
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
—
|
498
|
+
<div class='inline'><p>Whether pagination is supported.</p>
|
499
|
+
</div>
|
500
|
+
|
501
|
+
</li>
|
502
|
+
|
503
|
+
</ul>
|
504
|
+
|
505
|
+
</div><table class="source_code">
|
506
|
+
<tr>
|
507
|
+
<td>
|
508
|
+
<pre class="lines">
|
509
|
+
|
510
|
+
|
511
|
+
52
|
512
|
+
53
|
513
|
+
54</pre>
|
514
|
+
</td>
|
515
|
+
<td>
|
516
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/json_api/pagination_handling.rb', line 52</span>
|
517
|
+
|
518
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_supported?'>pagination_supported?</span>
|
519
|
+
<span class='ivar'>@objects</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:first</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@objects</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:last</span><span class='rparen'>)</span>
|
520
|
+
<span class='kw'>end</span></pre>
|
521
|
+
</td>
|
522
|
+
</tr>
|
523
|
+
</table>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
<div class="method_details ">
|
527
|
+
<h3 class="signature " id="pagination_url-instance_method">
|
528
|
+
|
529
|
+
- (<tt>String</tt>) <strong>pagination_url</strong>(key = nil)
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
</h3><div class="docstring">
|
536
|
+
<div class="discussion">
|
537
|
+
<p>Returns a URL to get a specific page of the current set of objects.</p>
|
538
|
+
|
539
|
+
|
540
|
+
</div>
|
541
|
+
</div>
|
542
|
+
<div class="tags">
|
543
|
+
<p class="tag_title">Parameters:</p>
|
544
|
+
<ul class="param">
|
545
|
+
|
546
|
+
<li>
|
547
|
+
|
548
|
+
<span class='name'>key</span>
|
549
|
+
|
550
|
+
|
551
|
+
<span class='type'>(<tt>String</tt>)</span>
|
552
|
+
|
553
|
+
|
554
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
555
|
+
|
556
|
+
|
557
|
+
—
|
558
|
+
<div class='inline'><p>The page to get. Supported values are <code>next</code>, <code>prev</code>, <code>previous</code> and <code>first</code>.</p>
|
559
|
+
</div>
|
560
|
+
|
561
|
+
</li>
|
562
|
+
|
563
|
+
</ul>
|
564
|
+
|
565
|
+
<p class="tag_title">Returns:</p>
|
566
|
+
<ul class="return">
|
567
|
+
|
568
|
+
<li>
|
569
|
+
|
570
|
+
|
571
|
+
<span class='type'>(<tt>String</tt>)</span>
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
—
|
576
|
+
<div class='inline'><p>A URL.</p>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
</li>
|
580
|
+
|
581
|
+
</ul>
|
582
|
+
|
583
|
+
</div><table class="source_code">
|
584
|
+
<tr>
|
585
|
+
<td>
|
586
|
+
<pre class="lines">
|
587
|
+
|
588
|
+
|
589
|
+
60
|
590
|
+
61
|
591
|
+
62
|
592
|
+
63</pre>
|
593
|
+
</td>
|
594
|
+
<td>
|
595
|
+
<pre class="code"><span class="info file"># File 'lib/ballast/concerns/json_api/pagination_handling.rb', line 60</span>
|
596
|
+
|
597
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_url'>pagination_url</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
598
|
+
<span class='id identifier rubyid_exist'>exist</span> <span class='op'>=</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_might_exist?'>might_exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='ivar'>@objects</span><span class='rparen'>)</span>
|
599
|
+
<span class='id identifier rubyid_exist'>exist</span> <span class='op'>?</span> <span class='id identifier rubyid_url_for'>url_for</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>page:</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='ivar'>@objects</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>field:</span> <span class='id identifier rubyid_pagination_field'>pagination_field</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>only_path:</span> <span class='kw'>false</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
600
|
+
<span class='kw'>end</span></pre>
|
601
|
+
</td>
|
602
|
+
</tr>
|
603
|
+
</table>
|
604
|
+
</div>
|
605
|
+
|
606
|
+
</div>
|
607
|
+
|
608
|
+
</div>
|
609
|
+
|
610
|
+
<div id="footer">
|
611
|
+
Generated on Thu Aug 18 15:49:49 2016 by
|
612
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
613
|
+
0.8.7.6 (ruby-2.3.0).
|
614
|
+
</div>
|
615
|
+
|
616
|
+
</body>
|
617
|
+
</html>
|