apes 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rubocop.yml +82 -0
  4. data/.travis-gemfile +15 -0
  5. data/.travis.yml +15 -0
  6. data/.yardopts +1 -0
  7. data/CHANGELOG.md +3 -0
  8. data/Gemfile +22 -0
  9. data/README.md +177 -0
  10. data/Rakefile +44 -0
  11. data/apes.gemspec +34 -0
  12. data/doc/Apes.html +130 -0
  13. data/doc/Apes/Concerns.html +127 -0
  14. data/doc/Apes/Concerns/Errors.html +1089 -0
  15. data/doc/Apes/Concerns/Pagination.html +636 -0
  16. data/doc/Apes/Concerns/Request.html +766 -0
  17. data/doc/Apes/Concerns/Response.html +940 -0
  18. data/doc/Apes/Controller.html +1100 -0
  19. data/doc/Apes/Errors.html +125 -0
  20. data/doc/Apes/Errors/AuthenticationError.html +133 -0
  21. data/doc/Apes/Errors/BadRequestError.html +157 -0
  22. data/doc/Apes/Errors/BaseError.html +320 -0
  23. data/doc/Apes/Errors/InvalidDataError.html +157 -0
  24. data/doc/Apes/Errors/MissingDataError.html +157 -0
  25. data/doc/Apes/Model.html +378 -0
  26. data/doc/Apes/PaginationCursor.html +2138 -0
  27. data/doc/Apes/RuntimeConfiguration.html +909 -0
  28. data/doc/Apes/Serializers.html +125 -0
  29. data/doc/Apes/Serializers/JSON.html +389 -0
  30. data/doc/Apes/Serializers/JWT.html +452 -0
  31. data/doc/Apes/Serializers/List.html +347 -0
  32. data/doc/Apes/UrlsParser.html +1432 -0
  33. data/doc/Apes/Validators.html +125 -0
  34. data/doc/Apes/Validators/BaseValidator.html +278 -0
  35. data/doc/Apes/Validators/BooleanValidator.html +494 -0
  36. data/doc/Apes/Validators/EmailValidator.html +350 -0
  37. data/doc/Apes/Validators/PhoneValidator.html +375 -0
  38. data/doc/Apes/Validators/ReferenceValidator.html +372 -0
  39. data/doc/Apes/Validators/TimestampValidator.html +640 -0
  40. data/doc/Apes/Validators/UuidValidator.html +372 -0
  41. data/doc/Apes/Validators/ZipCodeValidator.html +372 -0
  42. data/doc/Apes/Version.html +189 -0
  43. data/doc/ApplicationController.html +547 -0
  44. data/doc/Concerns.html +128 -0
  45. data/doc/Concerns/ErrorHandling.html +826 -0
  46. data/doc/Concerns/PaginationHandling.html +463 -0
  47. data/doc/Concerns/RequestHandling.html +512 -0
  48. data/doc/Concerns/ResponseHandling.html +579 -0
  49. data/doc/Errors.html +126 -0
  50. data/doc/Errors/AuthenticationError.html +123 -0
  51. data/doc/Errors/BadRequestError.html +147 -0
  52. data/doc/Errors/BaseError.html +289 -0
  53. data/doc/Errors/InvalidDataError.html +147 -0
  54. data/doc/Errors/MissingDataError.html +147 -0
  55. data/doc/Model.html +315 -0
  56. data/doc/PaginationCursor.html +764 -0
  57. data/doc/Serializers.html +126 -0
  58. data/doc/Serializers/JSON.html +253 -0
  59. data/doc/Serializers/JWT.html +253 -0
  60. data/doc/Serializers/List.html +245 -0
  61. data/doc/Validators.html +126 -0
  62. data/doc/Validators/BaseValidator.html +209 -0
  63. data/doc/Validators/BooleanValidator.html +391 -0
  64. data/doc/Validators/EmailValidator.html +298 -0
  65. data/doc/Validators/PhoneValidator.html +313 -0
  66. data/doc/Validators/ReferenceValidator.html +284 -0
  67. data/doc/Validators/TimestampValidator.html +476 -0
  68. data/doc/Validators/UuidValidator.html +310 -0
  69. data/doc/Validators/ZipCodeValidator.html +310 -0
  70. data/doc/_index.html +435 -0
  71. data/doc/class_list.html +58 -0
  72. data/doc/css/common.css +1 -0
  73. data/doc/css/full_list.css +57 -0
  74. data/doc/css/style.css +339 -0
  75. data/doc/file.README.html +252 -0
  76. data/doc/file_list.html +60 -0
  77. data/doc/frames.html +26 -0
  78. data/doc/index.html +252 -0
  79. data/doc/js/app.js +219 -0
  80. data/doc/js/full_list.js +181 -0
  81. data/doc/js/jquery.js +4 -0
  82. data/doc/method_list.html +615 -0
  83. data/doc/top-level-namespace.html +112 -0
  84. data/lib/apes.rb +40 -0
  85. data/lib/apes/concerns/errors.rb +111 -0
  86. data/lib/apes/concerns/pagination.rb +81 -0
  87. data/lib/apes/concerns/request.rb +237 -0
  88. data/lib/apes/concerns/response.rb +74 -0
  89. data/lib/apes/controller.rb +77 -0
  90. data/lib/apes/errors.rb +38 -0
  91. data/lib/apes/model.rb +94 -0
  92. data/lib/apes/pagination_cursor.rb +152 -0
  93. data/lib/apes/runtime_configuration.rb +80 -0
  94. data/lib/apes/serializers.rb +88 -0
  95. data/lib/apes/urls_parser.rb +233 -0
  96. data/lib/apes/validators.rb +234 -0
  97. data/lib/apes/version.rb +24 -0
  98. data/spec/apes/concerns/errors_spec.rb +141 -0
  99. data/spec/apes/concerns/pagination_spec.rb +114 -0
  100. data/spec/apes/concerns/request_spec.rb +244 -0
  101. data/spec/apes/concerns/response_spec.rb +79 -0
  102. data/spec/apes/controller_spec.rb +54 -0
  103. data/spec/apes/errors_spec.rb +14 -0
  104. data/spec/apes/models_spec.rb +148 -0
  105. data/spec/apes/pagination_cursor_spec.rb +113 -0
  106. data/spec/apes/runtime_configuration_spec.rb +100 -0
  107. data/spec/apes/serializers_spec.rb +70 -0
  108. data/spec/apes/urls_parser_spec.rb +150 -0
  109. data/spec/apes/validators_spec.rb +237 -0
  110. data/spec/spec_helper.rb +30 -0
  111. data/views/_included.json.jbuilder +9 -0
  112. data/views/_pagination.json.jbuilder +9 -0
  113. data/views/collection.json.jbuilder +4 -0
  114. data/views/errors/400.json.jbuilder +9 -0
  115. data/views/errors/403.json.jbuilder +7 -0
  116. data/views/errors/404.json.jbuilder +6 -0
  117. data/views/errors/422.json.jbuilder +19 -0
  118. data/views/errors/500.json.jbuilder +12 -0
  119. data/views/errors/501.json.jbuilder +7 -0
  120. data/views/layouts/general.json.jbuilder +36 -0
  121. data/views/object.json.jbuilder +4 -0
  122. metadata +262 -0
@@ -0,0 +1,764 @@
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
+ Class: PaginationCursor
8
+
9
+ &mdash; 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#!PaginationCursor.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> &raquo;
35
+
36
+
37
+ <span class="title">PaginationCursor</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>Class: PaginationCursor
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">PaginationCursor</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/apes/pagination_cursor.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>This file is part of the apes gem. Copyright (C) 2016 and above Shogun <a href="&#109;&#097;&#105;&#108;&#116;&#111;:&#115;&#104;&#111;&#103;&#117;&#110;&#064;&#099;&#111;&#119;&#116;&#101;&#099;&#104;&#046;&#105;&#116;">&#115;&#104;&#111;&#103;&#117;&#110;&#064;&#099;&#111;&#119;&#116;&#101;&#099;&#104;&#046;&#105;&#116;</a>.
105
+ Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+ <h2>Constant Summary</h2>
115
+
116
+ <dl class="constants">
117
+
118
+ <dt id="DEFAULT_SIZE-constant" class="">DEFAULT_SIZE =
119
+
120
+ </dt>
121
+ <dd><pre class="code"><span class='int'>25</span></pre></dd>
122
+
123
+ <dt id="TIMESTAMP_FORMAT-constant" class="">TIMESTAMP_FORMAT =
124
+
125
+ </dt>
126
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T.%6N%z</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
127
+
128
+ </dl>
129
+
130
+
131
+
132
+
133
+
134
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
135
+ <ul class="summary">
136
+
137
+ <li class="public ">
138
+ <span class="summary_signature">
139
+
140
+ <a href="#direction-instance_method" title="#direction (instance method)">- (Object) <strong>direction</strong> </a>
141
+
142
+
143
+
144
+ </span>
145
+
146
+
147
+
148
+
149
+ <span class="note title readonly">readonly</span>
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute direction.</p>
160
+ </div></span>
161
+
162
+ </li>
163
+
164
+
165
+ <li class="public ">
166
+ <span class="summary_signature">
167
+
168
+ <a href="#size-instance_method" title="#size (instance method)">- (Object) <strong>size</strong> </a>
169
+
170
+
171
+
172
+ </span>
173
+
174
+
175
+
176
+
177
+ <span class="note title readonly">readonly</span>
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute size.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ <li class="public ">
194
+ <span class="summary_signature">
195
+
196
+ <a href="#use_offset-instance_method" title="#use_offset (instance method)">- (Object) <strong>use_offset</strong> </a>
197
+
198
+
199
+
200
+ </span>
201
+
202
+
203
+
204
+
205
+ <span class="note title readonly">readonly</span>
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute use_offset.</p>
216
+ </div></span>
217
+
218
+ </li>
219
+
220
+
221
+ <li class="public ">
222
+ <span class="summary_signature">
223
+
224
+ <a href="#value-instance_method" title="#value (instance method)">- (Object) <strong>value</strong> </a>
225
+
226
+
227
+
228
+ </span>
229
+
230
+
231
+
232
+
233
+ <span class="note title readonly">readonly</span>
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute value.</p>
244
+ </div></span>
245
+
246
+ </li>
247
+
248
+
249
+ </ul>
250
+
251
+
252
+
253
+
254
+
255
+ <h2>
256
+ Instance Method Summary
257
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
258
+ </h2>
259
+
260
+ <ul class="summary">
261
+
262
+ <li class="public ">
263
+ <span class="summary_signature">
264
+
265
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (PaginationCursor) <strong>initialize</strong>(params = {}, field = :page, count_field = :count) </a>
266
+
267
+
268
+
269
+ </span>
270
+
271
+
272
+ <span class="note title constructor">constructor</span>
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+ <span class="summary_desc"><div class='inline'><p>A new instance of PaginationCursor.</p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#might_exist%3F-instance_method" title="#might_exist? (instance method)">- (Boolean) <strong>might_exist?</strong>(type, collection) </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+ <span class="summary_desc"><div class='inline'>
305
+ </div></span>
306
+
307
+ </li>
308
+
309
+
310
+ <li class="public ">
311
+ <span class="summary_signature">
312
+
313
+ <a href="#operator-instance_method" title="#operator (instance method)">- (Object) <strong>operator</strong>(order) </a>
314
+
315
+
316
+
317
+ </span>
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+ <span class="summary_desc"><div class='inline'>
328
+ </div></span>
329
+
330
+ </li>
331
+
332
+
333
+ <li class="public ">
334
+ <span class="summary_signature">
335
+
336
+ <a href="#save-instance_method" title="#save (instance method)">- (Object) <strong>save</strong>(collection, type, field: :id, size: nil, use_offset: nil) </a>
337
+
338
+
339
+
340
+ (also: #serialize)
341
+
342
+ </span>
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+ <span class="summary_desc"><div class='inline'>
353
+ </div></span>
354
+
355
+ </li>
356
+
357
+
358
+ </ul>
359
+
360
+
361
+ <div id="constructor_details" class="method_details_list">
362
+ <h2>Constructor Details</h2>
363
+
364
+ <div class="method_details first">
365
+ <h3 class="signature first" id="initialize-instance_method">
366
+
367
+ - (<tt><span class='object_link'><a href="" title="PaginationCursor (class)">PaginationCursor</a></span></tt>) <strong>initialize</strong>(params = {}, field = :page, count_field = :count)
368
+
369
+
370
+
371
+
372
+
373
+ </h3><div class="docstring">
374
+ <div class="discussion">
375
+ <p>Returns a new instance of PaginationCursor</p>
376
+
377
+
378
+ </div>
379
+ </div>
380
+ <div class="tags">
381
+
382
+
383
+ </div><table class="source_code">
384
+ <tr>
385
+ <td>
386
+ <pre class="lines">
387
+
388
+
389
+ 12
390
+ 13
391
+ 14
392
+ 15
393
+ 16
394
+ 17
395
+ 18
396
+ 19
397
+ 20
398
+ 21
399
+ 22
400
+ 23</pre>
401
+ </td>
402
+ <td>
403
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 12</span>
404
+
405
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_field'>field</span> <span class='op'>=</span> <span class='symbol'>:page</span><span class='comma'>,</span> <span class='id identifier rubyid_count_field'>count_field</span> <span class='op'>=</span> <span class='symbol'>:count</span><span class='rparen'>)</span>
406
+ <span class='kw'>begin</span>
407
+ <span class='id identifier rubyid_payload'>payload</span> <span class='op'>=</span> <span class='const'>JWT</span><span class='period'>.</span><span class='id identifier rubyid_decode'>decode</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='id identifier rubyid_field'>field</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_secrets'>secrets</span><span class='period'>.</span><span class='id identifier rubyid_jwt'>jwt</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>algorithm:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HS256</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>verify_aud:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>aud:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pagination</span><span class='tstring_end'>&quot;</span></span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>sub</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
408
+
409
+ <span class='id identifier rubyid_extract_payload'>extract_payload</span><span class='lparen'>(</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
410
+ <span class='kw'>rescue</span>
411
+ <span class='id identifier rubyid_default_payload'>default_payload</span>
412
+ <span class='kw'>end</span>
413
+
414
+ <span class='comment'># Sanitization
415
+ </span> <span class='id identifier rubyid_sanitize'>sanitize</span><span class='lparen'>(</span><span class='id identifier rubyid_count_field'>count_field</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
416
+ <span class='kw'>end</span></pre>
417
+ </td>
418
+ </tr>
419
+ </table>
420
+ </div>
421
+
422
+ </div>
423
+
424
+ <div id="instance_attr_details" class="attr_details">
425
+ <h2>Instance Attribute Details</h2>
426
+
427
+
428
+ <span id=""></span>
429
+ <div class="method_details first">
430
+ <h3 class="signature first" id="direction-instance_method">
431
+
432
+ - (<tt>Object</tt>) <strong>direction</strong> <span class="extras">(readonly)</span>
433
+
434
+
435
+
436
+
437
+
438
+ </h3><div class="docstring">
439
+ <div class="discussion">
440
+ <p>Returns the value of attribute direction</p>
441
+
442
+
443
+ </div>
444
+ </div>
445
+ <div class="tags">
446
+
447
+
448
+ </div><table class="source_code">
449
+ <tr>
450
+ <td>
451
+ <pre class="lines">
452
+
453
+
454
+ 10
455
+ 11
456
+ 12</pre>
457
+ </td>
458
+ <td>
459
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 10</span>
460
+
461
+ <span class='kw'>def</span> <span class='id identifier rubyid_direction'>direction</span>
462
+ <span class='ivar'>@direction</span>
463
+ <span class='kw'>end</span></pre>
464
+ </td>
465
+ </tr>
466
+ </table>
467
+ </div>
468
+
469
+
470
+ <span id=""></span>
471
+ <div class="method_details ">
472
+ <h3 class="signature " id="size-instance_method">
473
+
474
+ - (<tt>Object</tt>) <strong>size</strong> <span class="extras">(readonly)</span>
475
+
476
+
477
+
478
+
479
+
480
+ </h3><div class="docstring">
481
+ <div class="discussion">
482
+ <p>Returns the value of attribute size</p>
483
+
484
+
485
+ </div>
486
+ </div>
487
+ <div class="tags">
488
+
489
+
490
+ </div><table class="source_code">
491
+ <tr>
492
+ <td>
493
+ <pre class="lines">
494
+
495
+
496
+ 10
497
+ 11
498
+ 12</pre>
499
+ </td>
500
+ <td>
501
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 10</span>
502
+
503
+ <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
504
+ <span class='ivar'>@size</span>
505
+ <span class='kw'>end</span></pre>
506
+ </td>
507
+ </tr>
508
+ </table>
509
+ </div>
510
+
511
+
512
+ <span id=""></span>
513
+ <div class="method_details ">
514
+ <h3 class="signature " id="use_offset-instance_method">
515
+
516
+ - (<tt>Object</tt>) <strong>use_offset</strong> <span class="extras">(readonly)</span>
517
+
518
+
519
+
520
+
521
+
522
+ </h3><div class="docstring">
523
+ <div class="discussion">
524
+ <p>Returns the value of attribute use_offset</p>
525
+
526
+
527
+ </div>
528
+ </div>
529
+ <div class="tags">
530
+
531
+
532
+ </div><table class="source_code">
533
+ <tr>
534
+ <td>
535
+ <pre class="lines">
536
+
537
+
538
+ 10
539
+ 11
540
+ 12</pre>
541
+ </td>
542
+ <td>
543
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 10</span>
544
+
545
+ <span class='kw'>def</span> <span class='id identifier rubyid_use_offset'>use_offset</span>
546
+ <span class='ivar'>@use_offset</span>
547
+ <span class='kw'>end</span></pre>
548
+ </td>
549
+ </tr>
550
+ </table>
551
+ </div>
552
+
553
+
554
+ <span id=""></span>
555
+ <div class="method_details ">
556
+ <h3 class="signature " id="value-instance_method">
557
+
558
+ - (<tt>Object</tt>) <strong>value</strong> <span class="extras">(readonly)</span>
559
+
560
+
561
+
562
+
563
+
564
+ </h3><div class="docstring">
565
+ <div class="discussion">
566
+ <p>Returns the value of attribute value</p>
567
+
568
+
569
+ </div>
570
+ </div>
571
+ <div class="tags">
572
+
573
+
574
+ </div><table class="source_code">
575
+ <tr>
576
+ <td>
577
+ <pre class="lines">
578
+
579
+
580
+ 10
581
+ 11
582
+ 12</pre>
583
+ </td>
584
+ <td>
585
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 10</span>
586
+
587
+ <span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
588
+ <span class='ivar'>@value</span>
589
+ <span class='kw'>end</span></pre>
590
+ </td>
591
+ </tr>
592
+ </table>
593
+ </div>
594
+
595
+ </div>
596
+
597
+
598
+ <div id="instance_method_details" class="method_details_list">
599
+ <h2>Instance Method Details</h2>
600
+
601
+
602
+ <div class="method_details first">
603
+ <h3 class="signature first" id="might_exist?-instance_method">
604
+
605
+ - (<tt>Boolean</tt>) <strong>might_exist?</strong>(type, collection)
606
+
607
+
608
+
609
+
610
+
611
+ </h3><div class="docstring">
612
+ <div class="discussion">
613
+
614
+
615
+
616
+ </div>
617
+ </div>
618
+ <div class="tags">
619
+
620
+ <p class="tag_title">Returns:</p>
621
+ <ul class="return">
622
+
623
+ <li>
624
+
625
+
626
+ <span class='type'>(<tt>Boolean</tt>)</span>
627
+
628
+
629
+
630
+ </li>
631
+
632
+ </ul>
633
+
634
+ </div><table class="source_code">
635
+ <tr>
636
+ <td>
637
+ <pre class="lines">
638
+
639
+
640
+ 33
641
+ 34
642
+ 35
643
+ 36
644
+ 37
645
+ 38
646
+ 39</pre>
647
+ </td>
648
+ <td>
649
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 33</span>
650
+
651
+ <span class='kw'>def</span> <span class='id identifier rubyid_might_exist?'>might_exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_collection'>collection</span><span class='rparen'>)</span>
652
+ <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
653
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>first</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='kw'>true</span>
654
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>next</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
655
+ <span class='kw'>else</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='comment'># Previous
656
+ </span> <span class='kw'>end</span>
657
+ <span class='kw'>end</span></pre>
658
+ </td>
659
+ </tr>
660
+ </table>
661
+ </div>
662
+
663
+ <div class="method_details ">
664
+ <h3 class="signature " id="operator-instance_method">
665
+
666
+ - (<tt>Object</tt>) <strong>operator</strong>(order)
667
+
668
+
669
+
670
+
671
+
672
+ </h3><table class="source_code">
673
+ <tr>
674
+ <td>
675
+ <pre class="lines">
676
+
677
+
678
+ 25
679
+ 26
680
+ 27
681
+ 28
682
+ 29
683
+ 30
684
+ 31</pre>
685
+ </td>
686
+ <td>
687
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 25</span>
688
+
689
+ <span class='kw'>def</span> <span class='id identifier rubyid_operator'>operator</span><span class='lparen'>(</span><span class='id identifier rubyid_order'>order</span><span class='rparen'>)</span>
690
+ <span class='kw'>if</span> <span class='id identifier rubyid_direction'>direction</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>next</span><span class='tstring_end'>&quot;</span></span>
691
+ <span class='id identifier rubyid_order'>order</span> <span class='op'>==</span> <span class='symbol'>:asc</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&gt;</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># Descending order means newer results first
692
+ </span> <span class='kw'>else</span>
693
+ <span class='id identifier rubyid_order'>order</span> <span class='op'>==</span> <span class='symbol'>:asc</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&gt;</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># Descending order means newer results first
694
+ </span> <span class='kw'>end</span>
695
+ <span class='kw'>end</span></pre>
696
+ </td>
697
+ </tr>
698
+ </table>
699
+ </div>
700
+
701
+ <div class="method_details ">
702
+ <h3 class="signature " id="save-instance_method">
703
+
704
+ - (<tt>Object</tt>) <strong>save</strong>(collection, type, field: :id, size: nil, use_offset: nil)
705
+
706
+
707
+
708
+ <span class="aliases">Also known as:
709
+ <span class="names"><span id='serialize-instance_method'>serialize</span></span>
710
+ </span>
711
+
712
+
713
+
714
+ </h3><table class="source_code">
715
+ <tr>
716
+ <td>
717
+ <pre class="lines">
718
+
719
+
720
+ 41
721
+ 42
722
+ 43
723
+ 44
724
+ 45
725
+ 46
726
+ 47
727
+ 48
728
+ 49
729
+ 50
730
+ 51
731
+ 52</pre>
732
+ </td>
733
+ <td>
734
+ <pre class="code"><span class="info file"># File 'lib/apes/pagination_cursor.rb', line 41</span>
735
+
736
+ <span class='kw'>def</span> <span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='label'>field:</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>use_offset:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
737
+ <span class='id identifier rubyid_size'>size</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
738
+ <span class='id identifier rubyid_use_offset'>use_offset</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_use_offset'>use_offset</span> <span class='kw'>if</span> <span class='id identifier rubyid_use_offset'>use_offset</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
739
+ <span class='id identifier rubyid_direction'>direction</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_use_offset'>use_offset</span> <span class='op'>?</span> <span class='id identifier rubyid_update_with_offset'>update_with_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_update_with_field'>update_with_field</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_field'>field</span><span class='rparen'>)</span>
740
+
741
+ <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='const'>TIMESTAMP_FORMAT</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:strftime</span><span class='rparen'>)</span>
742
+
743
+ <span class='const'>JWT</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span>
744
+ <span class='lbrace'>{</span><span class='label'>aud:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>pagination</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>sub:</span> <span class='lbrace'>{</span><span class='label'>value:</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='label'>use_offset:</span> <span class='id identifier rubyid_use_offset'>use_offset</span><span class='comma'>,</span> <span class='label'>direction:</span> <span class='id identifier rubyid_direction'>direction</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='id identifier rubyid_size'>size</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='comma'>,</span>
745
+ <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_secrets'>secrets</span><span class='period'>.</span><span class='id identifier rubyid_jwt'>jwt</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HS256</span><span class='tstring_end'>&quot;</span></span>
746
+ <span class='rparen'>)</span>
747
+ <span class='kw'>end</span></pre>
748
+ </td>
749
+ </tr>
750
+ </table>
751
+ </div>
752
+
753
+ </div>
754
+
755
+ </div>
756
+
757
+ <div id="footer">
758
+ Generated on Sat May 21 09:16:38 2016 by
759
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
760
+ 0.8.7.6 (ruby-2.3.0).
761
+ </div>
762
+
763
+ </body>
764
+ </html>