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,563 @@
|
|
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::Util::RelationshipPayload
|
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::Util::RelationshipPayload";
|
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 (R)</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="../Util.html" title="JsonapiCompliable::Util (module)">Util</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">RelationshipPayload</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::Util::RelationshipPayload
|
63
|
+
|
64
|
+
|
65
|
+
<span class="private note title">Private</span>
|
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::Util::RelationshipPayload</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/util/relationship_payload.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p class="note private">
|
105
|
+
<strong>This class is part of a private API.</strong>
|
106
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
107
|
+
</p>
|
108
|
+
|
109
|
+
<p>Helper methods for traversing the 'relationships' JSONAPI payloads</p>
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div class="tags">
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
122
|
+
<ul class="summary">
|
123
|
+
|
124
|
+
<li class="public ">
|
125
|
+
<span class="summary_signature">
|
126
|
+
|
127
|
+
<a href="#payload-instance_method" title="#payload (instance method)">#<strong>payload</strong> ⇒ Object </a>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
</span>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<span class="note title readonly">readonly</span>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="private note title">private</span>
|
144
|
+
|
145
|
+
|
146
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#resource-instance_method" title="#resource (instance method)">#<strong>resource</strong> ⇒ Object </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<span class="note title readonly">readonly</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<span class="private note title">private</span>
|
171
|
+
|
172
|
+
|
173
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
</ul>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<h2>
|
185
|
+
Class Method Summary
|
186
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
187
|
+
</h2>
|
188
|
+
|
189
|
+
<ul class="summary">
|
190
|
+
|
191
|
+
<li class="public ">
|
192
|
+
<span class="summary_signature">
|
193
|
+
|
194
|
+
<a href="#iterate-class_method" title="iterate (class method)">.<strong>iterate</strong>(resource:, relationships: {}, only: [], except: []) ⇒ Object </a>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<span class="private note title">private</span>
|
206
|
+
|
207
|
+
|
208
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
209
|
+
|
210
|
+
</li>
|
211
|
+
|
212
|
+
|
213
|
+
</ul>
|
214
|
+
|
215
|
+
<h2>
|
216
|
+
Instance Method Summary
|
217
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
218
|
+
</h2>
|
219
|
+
|
220
|
+
<ul class="summary">
|
221
|
+
|
222
|
+
<li class="public ">
|
223
|
+
<span class="summary_signature">
|
224
|
+
|
225
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(resource, payload, only: [], except: []) ⇒ RelationshipPayload </a>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
</span>
|
230
|
+
|
231
|
+
|
232
|
+
<span class="note title constructor">constructor</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<span class="private note title">private</span>
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'>
|
242
|
+
<p>A new instance of RelationshipPayload.</p>
|
243
|
+
</div></span>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
|
248
|
+
<li class="public ">
|
249
|
+
<span class="summary_signature">
|
250
|
+
|
251
|
+
<a href="#iterate-instance_method" title="#iterate (instance method)">#<strong>iterate</strong> ⇒ Object </a>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</span>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<span class="private note title">private</span>
|
263
|
+
|
264
|
+
|
265
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
266
|
+
|
267
|
+
</li>
|
268
|
+
|
269
|
+
|
270
|
+
</ul>
|
271
|
+
|
272
|
+
|
273
|
+
<div id="constructor_details" class="method_details_list">
|
274
|
+
<h2>Constructor Details</h2>
|
275
|
+
|
276
|
+
<div class="method_details first">
|
277
|
+
<h3 class="signature first" id="initialize-instance_method">
|
278
|
+
|
279
|
+
#<strong>initialize</strong>(resource, payload, only: [], except: []) ⇒ <tt><span class='object_link'><a href="" title="JsonapiCompliable::Util::RelationshipPayload (class)">RelationshipPayload</a></span></tt>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
</h3><div class="docstring">
|
286
|
+
<div class="discussion">
|
287
|
+
<p class="note private">
|
288
|
+
<strong>This method is part of a private API.</strong>
|
289
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
290
|
+
</p>
|
291
|
+
|
292
|
+
<p>Returns a new instance of RelationshipPayload</p>
|
293
|
+
|
294
|
+
|
295
|
+
</div>
|
296
|
+
</div>
|
297
|
+
<div class="tags">
|
298
|
+
|
299
|
+
|
300
|
+
</div><table class="source_code">
|
301
|
+
<tr>
|
302
|
+
<td>
|
303
|
+
<pre class="lines">
|
304
|
+
|
305
|
+
|
306
|
+
15
|
307
|
+
16
|
308
|
+
17
|
309
|
+
18
|
310
|
+
19
|
311
|
+
20</pre>
|
312
|
+
</td>
|
313
|
+
<td>
|
314
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/relationship_payload.rb', line 15</span>
|
315
|
+
|
316
|
+
<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_payload'>payload</span><span class='comma'>,</span> <span class='label'>only:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>except:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
317
|
+
<span class='ivar'>@resource</span> <span class='op'>=</span> <span class='id identifier rubyid_resource'>resource</span>
|
318
|
+
<span class='ivar'>@payload</span> <span class='op'>=</span> <span class='id identifier rubyid_payload'>payload</span>
|
319
|
+
<span class='ivar'>@only</span> <span class='op'>=</span> <span class='id identifier rubyid_only'>only</span>
|
320
|
+
<span class='ivar'>@except</span> <span class='op'>=</span> <span class='id identifier rubyid_except'>except</span>
|
321
|
+
<span class='kw'>end</span></pre>
|
322
|
+
</td>
|
323
|
+
</tr>
|
324
|
+
</table>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
<div id="instance_attr_details" class="attr_details">
|
330
|
+
<h2>Instance Attribute Details</h2>
|
331
|
+
|
332
|
+
|
333
|
+
<span id=""></span>
|
334
|
+
<div class="method_details first">
|
335
|
+
<h3 class="signature first" id="payload-instance_method">
|
336
|
+
|
337
|
+
#<strong>payload</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
</h3><div class="docstring">
|
344
|
+
<div class="discussion">
|
345
|
+
<p class="note private">
|
346
|
+
<strong>This method is part of a private API.</strong>
|
347
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
348
|
+
</p>
|
349
|
+
|
350
|
+
|
351
|
+
</div>
|
352
|
+
</div>
|
353
|
+
<div class="tags">
|
354
|
+
|
355
|
+
|
356
|
+
</div><table class="source_code">
|
357
|
+
<tr>
|
358
|
+
<td>
|
359
|
+
<pre class="lines">
|
360
|
+
|
361
|
+
|
362
|
+
6
|
363
|
+
7
|
364
|
+
8</pre>
|
365
|
+
</td>
|
366
|
+
<td>
|
367
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/relationship_payload.rb', line 6</span>
|
368
|
+
|
369
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_payload'>payload</span>
|
370
|
+
<span class='ivar'>@payload</span>
|
371
|
+
<span class='kw'>end</span></pre>
|
372
|
+
</td>
|
373
|
+
</tr>
|
374
|
+
</table>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
|
378
|
+
<span id=""></span>
|
379
|
+
<div class="method_details ">
|
380
|
+
<h3 class="signature " id="resource-instance_method">
|
381
|
+
|
382
|
+
#<strong>resource</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</h3><div class="docstring">
|
389
|
+
<div class="discussion">
|
390
|
+
<p class="note private">
|
391
|
+
<strong>This method is part of a private API.</strong>
|
392
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
393
|
+
</p>
|
394
|
+
|
395
|
+
|
396
|
+
</div>
|
397
|
+
</div>
|
398
|
+
<div class="tags">
|
399
|
+
|
400
|
+
|
401
|
+
</div><table class="source_code">
|
402
|
+
<tr>
|
403
|
+
<td>
|
404
|
+
<pre class="lines">
|
405
|
+
|
406
|
+
|
407
|
+
6
|
408
|
+
7
|
409
|
+
8</pre>
|
410
|
+
</td>
|
411
|
+
<td>
|
412
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/relationship_payload.rb', line 6</span>
|
413
|
+
|
414
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_resource'>resource</span>
|
415
|
+
<span class='ivar'>@resource</span>
|
416
|
+
<span class='kw'>end</span></pre>
|
417
|
+
</td>
|
418
|
+
</tr>
|
419
|
+
</table>
|
420
|
+
</div>
|
421
|
+
|
422
|
+
</div>
|
423
|
+
|
424
|
+
|
425
|
+
<div id="class_method_details" class="method_details_list">
|
426
|
+
<h2>Class Method Details</h2>
|
427
|
+
|
428
|
+
|
429
|
+
<div class="method_details first">
|
430
|
+
<h3 class="signature first" id="iterate-class_method">
|
431
|
+
|
432
|
+
.<strong>iterate</strong>(resource:, relationships: {}, only: [], except: []) ⇒ <tt>Object</tt>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
</h3><div class="docstring">
|
439
|
+
<div class="discussion">
|
440
|
+
<p class="note private">
|
441
|
+
<strong>This method is part of a private API.</strong>
|
442
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
443
|
+
</p>
|
444
|
+
|
445
|
+
|
446
|
+
</div>
|
447
|
+
</div>
|
448
|
+
<div class="tags">
|
449
|
+
|
450
|
+
|
451
|
+
</div><table class="source_code">
|
452
|
+
<tr>
|
453
|
+
<td>
|
454
|
+
<pre class="lines">
|
455
|
+
|
456
|
+
|
457
|
+
8
|
458
|
+
9
|
459
|
+
10
|
460
|
+
11
|
461
|
+
12
|
462
|
+
13</pre>
|
463
|
+
</td>
|
464
|
+
<td>
|
465
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/relationship_payload.rb', line 8</span>
|
466
|
+
|
467
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_iterate'>iterate</span><span class='lparen'>(</span><span class='label'>resource:</span><span class='comma'>,</span> <span class='label'>relationships:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>only:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>except:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
468
|
+
<span class='id identifier rubyid_instance'>instance</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_resource'>resource</span><span class='comma'>,</span> <span class='id identifier rubyid_relationships'>relationships</span><span class='comma'>,</span> <span class='label'>only:</span> <span class='id identifier rubyid_only'>only</span><span class='comma'>,</span> <span class='label'>except:</span> <span class='id identifier rubyid_except'>except</span><span class='rparen'>)</span>
|
469
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_iterate'>iterate</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sideload'>sideload</span><span class='comma'>,</span> <span class='id identifier rubyid_relationship_data'>relationship_data</span><span class='comma'>,</span> <span class='id identifier rubyid_sub_relationships'>sub_relationships</span><span class='op'>|</span>
|
470
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_sideload'>sideload</span><span class='comma'>,</span> <span class='id identifier rubyid_relationship_data'>relationship_data</span><span class='comma'>,</span> <span class='id identifier rubyid_sub_relationships'>sub_relationships</span>
|
471
|
+
<span class='kw'>end</span>
|
472
|
+
<span class='kw'>end</span></pre>
|
473
|
+
</td>
|
474
|
+
</tr>
|
475
|
+
</table>
|
476
|
+
</div>
|
477
|
+
|
478
|
+
</div>
|
479
|
+
|
480
|
+
<div id="instance_method_details" class="method_details_list">
|
481
|
+
<h2>Instance Method Details</h2>
|
482
|
+
|
483
|
+
|
484
|
+
<div class="method_details first">
|
485
|
+
<h3 class="signature first" id="iterate-instance_method">
|
486
|
+
|
487
|
+
#<strong>iterate</strong> ⇒ <tt>Object</tt>
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
</h3><div class="docstring">
|
494
|
+
<div class="discussion">
|
495
|
+
<p class="note private">
|
496
|
+
<strong>This method is part of a private API.</strong>
|
497
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
498
|
+
</p>
|
499
|
+
|
500
|
+
|
501
|
+
</div>
|
502
|
+
</div>
|
503
|
+
<div class="tags">
|
504
|
+
|
505
|
+
|
506
|
+
</div><table class="source_code">
|
507
|
+
<tr>
|
508
|
+
<td>
|
509
|
+
<pre class="lines">
|
510
|
+
|
511
|
+
|
512
|
+
22
|
513
|
+
23
|
514
|
+
24
|
515
|
+
25
|
516
|
+
26
|
517
|
+
27
|
518
|
+
28
|
519
|
+
29
|
520
|
+
30
|
521
|
+
31
|
522
|
+
32
|
523
|
+
33
|
524
|
+
34
|
525
|
+
35
|
526
|
+
36</pre>
|
527
|
+
</td>
|
528
|
+
<td>
|
529
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/relationship_payload.rb', line 22</span>
|
530
|
+
|
531
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_iterate'>iterate</span>
|
532
|
+
<span class='id identifier rubyid_payload'>payload</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_relationship_name'>relationship_name</span><span class='comma'>,</span> <span class='id identifier rubyid_relationship_payload'>relationship_payload</span><span class='op'>|</span>
|
533
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_sl'>sl</span> <span class='op'>=</span> <span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_sideload'>sideload</span><span class='lparen'>(</span><span class='id identifier rubyid_relationship_name'>relationship_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span>
|
534
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_should_yield?'>should_yield?</span><span class='lparen'>(</span><span class='id identifier rubyid_sl'>sl</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
|
535
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_relationship_payload'>relationship_payload</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
|
536
|
+
<span class='id identifier rubyid_relationship_payload'>relationship_payload</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_rp'>rp</span><span class='op'>|</span>
|
537
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_payload_for'>payload_for</span><span class='lparen'>(</span><span class='id identifier rubyid_sl'>sl</span><span class='comma'>,</span> <span class='id identifier rubyid_rp'>rp</span><span class='rparen'>)</span>
|
538
|
+
<span class='kw'>end</span>
|
539
|
+
<span class='kw'>else</span>
|
540
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_payload_for'>payload_for</span><span class='lparen'>(</span><span class='id identifier rubyid_sl'>sl</span><span class='comma'>,</span> <span class='id identifier rubyid_relationship_payload'>relationship_payload</span><span class='rparen'>)</span>
|
541
|
+
<span class='kw'>end</span>
|
542
|
+
<span class='kw'>end</span>
|
543
|
+
<span class='kw'>end</span>
|
544
|
+
<span class='kw'>end</span>
|
545
|
+
<span class='kw'>end</span></pre>
|
546
|
+
</td>
|
547
|
+
</tr>
|
548
|
+
</table>
|
549
|
+
</div>
|
550
|
+
|
551
|
+
</div>
|
552
|
+
|
553
|
+
</div>
|
554
|
+
|
555
|
+
<div id="footer">
|
556
|
+
Generated on Fri May 5 15:53:23 2017 by
|
557
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
558
|
+
0.9.9 (ruby-2.3.0).
|
559
|
+
</div>
|
560
|
+
|
561
|
+
</div>
|
562
|
+
</body>
|
563
|
+
</html>
|