jsonapi_compliable 0.6.13 → 0.7.2
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/.yardopts +1 -0
- data/docs/Jsonapi/ResourceGenerator.html +325 -0
- data/docs/Jsonapi.html +115 -0
- data/docs/JsonapiCompliable/Adapters/Abstract.html +1 -1
- data/docs/JsonapiCompliable/Adapters/ActiveRecord.html +59 -53
- data/docs/JsonapiCompliable/Adapters/ActiveRecordSideloading.html +6 -6
- data/docs/JsonapiCompliable/Adapters/Null.html +1 -1
- data/docs/JsonapiCompliable/Adapters.html +1 -1
- data/docs/JsonapiCompliable/Base.html +113 -117
- data/docs/JsonapiCompliable/Deserializer.html +87 -22
- data/docs/JsonapiCompliable/Errors/BadFilter.html +1 -1
- data/docs/JsonapiCompliable/Errors/StatNotFound.html +1 -1
- data/docs/JsonapiCompliable/Errors/UnsupportedPageSize.html +1 -1
- data/docs/JsonapiCompliable/Errors/ValidationError.html +1 -1
- data/docs/JsonapiCompliable/Errors.html +1 -1
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute/ClassMethods.html +1 -1
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute.html +1 -1
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute/ClassMethods.html +1 -1
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute.html +1 -1
- data/docs/JsonapiCompliable/Extensions.html +1 -1
- data/docs/JsonapiCompliable/Query.html +19 -17
- data/docs/JsonapiCompliable/Rails.html +1 -1
- data/docs/JsonapiCompliable/Resource.html +311 -220
- data/docs/JsonapiCompliable/Scope.html +1 -1
- data/docs/JsonapiCompliable/Scoping/Base.html +1 -1
- data/docs/JsonapiCompliable/Scoping/DefaultFilter.html +1 -1
- data/docs/JsonapiCompliable/Scoping/ExtraFields.html +1 -1
- data/docs/JsonapiCompliable/Scoping/Filter.html +1 -1
- data/docs/JsonapiCompliable/Scoping/Filterable.html +2 -2
- data/docs/JsonapiCompliable/Scoping/Paginate.html +1 -1
- data/docs/JsonapiCompliable/Scoping/Sort.html +1 -1
- data/docs/JsonapiCompliable/Scoping.html +1 -1
- data/docs/JsonapiCompliable/SerializableTempId.html +1 -1
- data/docs/JsonapiCompliable/Sideload.html +229 -78
- data/docs/JsonapiCompliable/Stats/DSL.html +1 -1
- data/docs/JsonapiCompliable/Stats/Payload.html +1 -1
- data/docs/JsonapiCompliable/Stats.html +1 -1
- data/docs/JsonapiCompliable/Util/FieldParams.html +1 -1
- data/docs/JsonapiCompliable/Util/Hash.html +1 -1
- data/docs/JsonapiCompliable/Util/IncludeParams.html +1 -1
- data/docs/JsonapiCompliable/Util/Persistence.html +1 -1
- data/docs/JsonapiCompliable/Util/RelationshipPayload.html +1 -1
- data/docs/JsonapiCompliable/Util/RenderOptions.html +1 -1
- data/docs/JsonapiCompliable/Util/ValidationResponse.html +1 -1
- data/docs/JsonapiCompliable/Util.html +1 -1
- data/docs/JsonapiCompliable.html +210 -3
- data/docs/_index.html +13 -1
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +4 -2
- data/docs/index.html +4 -2
- data/docs/method_list.html +307 -243
- data/docs/top-level-namespace.html +2 -2
- data/lib/generators/jsonapi/resource_generator.rb +139 -58
- data/lib/generators/jsonapi/templates/application_resource.rb.erb +11 -2
- data/lib/generators/jsonapi/templates/controller.rb.erb +34 -0
- data/lib/generators/jsonapi/templates/destroy_request_spec.rb.erb +1 -1
- data/lib/generators/jsonapi/templates/payload.rb.erb +31 -0
- data/lib/generators/jsonapi/templates/resource.rb.erb +47 -0
- data/lib/generators/jsonapi/templates/serializer.rb.erb +17 -0
- data/lib/jsonapi_compliable/adapters/active_record_sideloading.rb +5 -5
- data/lib/jsonapi_compliable/resource.rb +11 -5
- data/lib/jsonapi_compliable/sideload.rb +40 -11
- data/lib/jsonapi_compliable/util/persistence.rb +9 -2
- data/lib/jsonapi_compliable/util/relationship_payload.rb +6 -0
- data/lib/jsonapi_compliable/util/validation_response.rb +2 -1
- data/lib/jsonapi_compliable/version.rb +1 -1
- metadata +4 -2
|
@@ -224,7 +224,7 @@ serialized parameters.</p>
|
|
|
224
224
|
<li class="public ">
|
|
225
225
|
<span class="summary_signature">
|
|
226
226
|
|
|
227
|
-
<a href="#
|
|
227
|
+
<a href="#jsonapi_resource-instance_method" title="#jsonapi_resource (instance method)">#<strong>jsonapi_resource</strong> ⇒ Resource </a>
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
|
|
@@ -239,7 +239,7 @@ serialized parameters.</p>
|
|
|
239
239
|
|
|
240
240
|
|
|
241
241
|
<span class="summary_desc"><div class='inline'>
|
|
242
|
-
<p>
|
|
242
|
+
<p>Returns an instance of the associated Resource.</p>
|
|
243
243
|
</div></span>
|
|
244
244
|
|
|
245
245
|
</li>
|
|
@@ -248,7 +248,7 @@ serialized parameters.</p>
|
|
|
248
248
|
<li class="public ">
|
|
249
249
|
<span class="summary_signature">
|
|
250
250
|
|
|
251
|
-
<a href="#
|
|
251
|
+
<a href="#jsonapi_scope-instance_method" title="#jsonapi_scope (instance method)">#<strong>jsonapi_scope</strong>(scope, opts = {}) ⇒ Scope </a>
|
|
252
252
|
|
|
253
253
|
|
|
254
254
|
|
|
@@ -263,8 +263,7 @@ serialized parameters.</p>
|
|
|
263
263
|
|
|
264
264
|
|
|
265
265
|
<span class="summary_desc"><div class='inline'>
|
|
266
|
-
<p>
|
|
267
|
-
serialized parameters.</p>
|
|
266
|
+
<p>Use when direct, low-level access to the scope is required.</p>
|
|
268
267
|
</div></span>
|
|
269
268
|
|
|
270
269
|
</li>
|
|
@@ -273,7 +272,7 @@ serialized parameters.</p>
|
|
|
273
272
|
<li class="public ">
|
|
274
273
|
<span class="summary_signature">
|
|
275
274
|
|
|
276
|
-
<a href="#
|
|
275
|
+
<a href="#jsonapi_update-instance_method" title="#jsonapi_update (instance method)">#<strong>jsonapi_update</strong> ⇒ Util::ValidationResponse </a>
|
|
277
276
|
|
|
278
277
|
|
|
279
278
|
|
|
@@ -288,7 +287,8 @@ serialized parameters.</p>
|
|
|
288
287
|
|
|
289
288
|
|
|
290
289
|
<span class="summary_desc"><div class='inline'>
|
|
291
|
-
<p>
|
|
290
|
+
<p>Update the resource model and process all nested relationships via the
|
|
291
|
+
serialized parameters.</p>
|
|
292
292
|
</div></span>
|
|
293
293
|
|
|
294
294
|
</li>
|
|
@@ -297,7 +297,7 @@ serialized parameters.</p>
|
|
|
297
297
|
<li class="public ">
|
|
298
298
|
<span class="summary_signature">
|
|
299
299
|
|
|
300
|
-
<a href="#
|
|
300
|
+
<a href="#query-instance_method" title="#query (instance method)">#<strong>query</strong> ⇒ Query </a>
|
|
301
301
|
|
|
302
302
|
|
|
303
303
|
|
|
@@ -312,7 +312,7 @@ serialized parameters.</p>
|
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
<span class="summary_desc"><div class='inline'>
|
|
315
|
-
<p>
|
|
315
|
+
<p>Instantiates the relevant Query object.</p>
|
|
316
316
|
</div></span>
|
|
317
317
|
|
|
318
318
|
</li>
|
|
@@ -321,7 +321,7 @@ serialized parameters.</p>
|
|
|
321
321
|
<li class="public ">
|
|
322
322
|
<span class="summary_signature">
|
|
323
323
|
|
|
324
|
-
<a href="#
|
|
324
|
+
<a href="#query_hash-instance_method" title="#query_hash (instance method)">#<strong>query_hash</strong> ⇒ Hash </a>
|
|
325
325
|
|
|
326
326
|
|
|
327
327
|
|
|
@@ -336,7 +336,7 @@ serialized parameters.</p>
|
|
|
336
336
|
|
|
337
337
|
|
|
338
338
|
<span class="summary_desc"><div class='inline'>
|
|
339
|
-
<p>
|
|
339
|
+
<p>The normalized query hash for only the <strong>current</strong> resource.</p>
|
|
340
340
|
</div></span>
|
|
341
341
|
|
|
342
342
|
</li>
|
|
@@ -345,7 +345,7 @@ serialized parameters.</p>
|
|
|
345
345
|
<li class="public ">
|
|
346
346
|
<span class="summary_signature">
|
|
347
347
|
|
|
348
|
-
<a href="#
|
|
348
|
+
<a href="#render_jsonapi-instance_method" title="#render_jsonapi (instance method)">#<strong>render_jsonapi</strong>(scope, opts = {}) ⇒ Object </a>
|
|
349
349
|
|
|
350
350
|
|
|
351
351
|
|
|
@@ -360,7 +360,7 @@ serialized parameters.</p>
|
|
|
360
360
|
|
|
361
361
|
|
|
362
362
|
<span class="summary_desc"><div class='inline'>
|
|
363
|
-
<p>
|
|
363
|
+
<p>Similar to <tt>render :json</tt> or <tt>render :jsonapi</tt>.</p>
|
|
364
364
|
</div></span>
|
|
365
365
|
|
|
366
366
|
</li>
|
|
@@ -584,13 +584,13 @@ render jsonapi: foo, default_jsonapi_render_options</code></pre>
|
|
|
584
584
|
<pre class="lines">
|
|
585
585
|
|
|
586
586
|
|
|
587
|
+
238
|
|
588
|
+
239
|
|
587
589
|
240
|
|
588
|
-
241
|
|
589
|
-
242
|
|
590
|
-
243</pre>
|
|
590
|
+
241</pre>
|
|
591
591
|
</td>
|
|
592
592
|
<td>
|
|
593
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line
|
|
593
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 238</span>
|
|
594
594
|
|
|
595
595
|
<span class='kw'>def</span> <span class='id identifier rubyid_default_jsonapi_render_options'>default_jsonapi_render_options</span>
|
|
596
596
|
<span class='lbrace'>{</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
|
|
@@ -645,12 +645,12 @@ render jsonapi: foo, default_jsonapi_render_options</code></pre>
|
|
|
645
645
|
<pre class="lines">
|
|
646
646
|
|
|
647
647
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
648
|
+
119
|
|
649
|
+
120
|
|
650
|
+
121</pre>
|
|
651
651
|
</td>
|
|
652
652
|
<td>
|
|
653
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line
|
|
653
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 119</span>
|
|
654
654
|
|
|
655
655
|
<span class='kw'>def</span> <span class='id identifier rubyid_deserialized_params'>deserialized_params</span>
|
|
656
656
|
<span class='ivar'>@deserialized_params</span> <span class='op'>||=</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="Deserializer.html" title="JsonapiCompliable::Deserializer (class)">Deserializer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Deserializer.html#initialize-instance_method" title="JsonapiCompliable::Deserializer#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
|
@@ -725,7 +725,7 @@ back the transaction.</p>
|
|
|
725
725
|
|
|
726
726
|
<li><span class='object_link'><a href="Resource.html#model-class_method" title="JsonapiCompliable::Resource.model (method)">Resource.model</a></span></li>
|
|
727
727
|
|
|
728
|
-
<li
|
|
728
|
+
<li>#resource</li>
|
|
729
729
|
|
|
730
730
|
<li><span class='object_link'><a href="#deserialized_params-instance_method" title="JsonapiCompliable::Base#deserialized_params (method)">#deserialized_params</a></span></li>
|
|
731
731
|
|
|
@@ -737,21 +737,21 @@ back the transaction.</p>
|
|
|
737
737
|
<pre class="lines">
|
|
738
738
|
|
|
739
739
|
|
|
740
|
+
147
|
|
741
|
+
148
|
|
740
742
|
149
|
|
741
743
|
150
|
|
742
744
|
151
|
|
743
745
|
152
|
|
744
746
|
153
|
|
745
|
-
154
|
|
746
|
-
155
|
|
747
|
-
156</pre>
|
|
747
|
+
154</pre>
|
|
748
748
|
</td>
|
|
749
749
|
<td>
|
|
750
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line
|
|
750
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 147</span>
|
|
751
751
|
|
|
752
752
|
<span class='kw'>def</span> <span class='id identifier rubyid_jsonapi_create'>jsonapi_create</span>
|
|
753
753
|
<span class='id identifier rubyid__persist'>_persist</span> <span class='kw'>do</span>
|
|
754
|
-
<span class='id identifier
|
|
754
|
+
<span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span><span class='period'>.</span><span class='id identifier rubyid_persist_with_relationships'>persist_with_relationships</span> \
|
|
755
755
|
<span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_meta'>meta</span><span class='comma'>,</span>
|
|
756
756
|
<span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='comma'>,</span>
|
|
757
757
|
<span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_relationships'>relationships</span>
|
|
@@ -760,6 +760,72 @@ back the transaction.</p>
|
|
|
760
760
|
</td>
|
|
761
761
|
</tr>
|
|
762
762
|
</table>
|
|
763
|
+
</div>
|
|
764
|
+
|
|
765
|
+
<div class="method_details ">
|
|
766
|
+
<h3 class="signature " id="jsonapi_resource-instance_method">
|
|
767
|
+
|
|
768
|
+
#<strong>jsonapi_resource</strong> ⇒ <tt><span class='object_link'><a href="Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt>
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
</h3><div class="docstring">
|
|
775
|
+
<div class="discussion">
|
|
776
|
+
|
|
777
|
+
<p>Returns an instance of the associated Resource</p>
|
|
778
|
+
|
|
779
|
+
<p>In other words, if you configured your controller as:</p>
|
|
780
|
+
|
|
781
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_jsonapi'>jsonapi</span> <span class='label'>resource:</span> <span class='const'>MyResource</span>
|
|
782
|
+
</code></pre>
|
|
783
|
+
|
|
784
|
+
<p>This returns MyResource.new</p>
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
</div>
|
|
788
|
+
</div>
|
|
789
|
+
<div class="tags">
|
|
790
|
+
|
|
791
|
+
<p class="tag_title">Returns:</p>
|
|
792
|
+
<ul class="return">
|
|
793
|
+
|
|
794
|
+
<li>
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
<span class='type'>(<tt><span class='object_link'><a href="Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt>)</span>
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
—
|
|
802
|
+
<div class='inline'>
|
|
803
|
+
<p>the configured Resource for this controller</p>
|
|
804
|
+
</div>
|
|
805
|
+
|
|
806
|
+
</li>
|
|
807
|
+
|
|
808
|
+
</ul>
|
|
809
|
+
|
|
810
|
+
</div><table class="source_code">
|
|
811
|
+
<tr>
|
|
812
|
+
<td>
|
|
813
|
+
<pre class="lines">
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
66
|
|
817
|
+
67
|
|
818
|
+
68</pre>
|
|
819
|
+
</td>
|
|
820
|
+
<td>
|
|
821
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 66</span>
|
|
822
|
+
|
|
823
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span>
|
|
824
|
+
<span class='ivar'>@jsonapi_resource</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid__jsonapi_compliable'>_jsonapi_compliable</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
825
|
+
<span class='kw'>end</span></pre>
|
|
826
|
+
</td>
|
|
827
|
+
</tr>
|
|
828
|
+
</table>
|
|
763
829
|
</div>
|
|
764
830
|
|
|
765
831
|
<div class="method_details ">
|
|
@@ -839,15 +905,15 @@ back the transaction.</p>
|
|
|
839
905
|
<pre class="lines">
|
|
840
906
|
|
|
841
907
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
908
|
+
113
|
|
909
|
+
114
|
|
910
|
+
115</pre>
|
|
845
911
|
</td>
|
|
846
912
|
<td>
|
|
847
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line
|
|
913
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 113</span>
|
|
848
914
|
|
|
849
915
|
<span class='kw'>def</span> <span class='id identifier rubyid_jsonapi_scope'>jsonapi_scope</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
850
|
-
<span class='id identifier
|
|
916
|
+
<span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span><span class='period'>.</span><span class='id identifier rubyid_build_scope'>build_scope</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
|
851
917
|
<span class='kw'>end</span></pre>
|
|
852
918
|
</td>
|
|
853
919
|
</tr>
|
|
@@ -927,21 +993,21 @@ back the transaction.</p>
|
|
|
927
993
|
<pre class="lines">
|
|
928
994
|
|
|
929
995
|
|
|
996
|
+
178
|
|
997
|
+
179
|
|
930
998
|
180
|
|
931
999
|
181
|
|
932
1000
|
182
|
|
933
1001
|
183
|
|
934
1002
|
184
|
|
935
|
-
185
|
|
936
|
-
186
|
|
937
|
-
187</pre>
|
|
1003
|
+
185</pre>
|
|
938
1004
|
</td>
|
|
939
1005
|
<td>
|
|
940
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line
|
|
1006
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 178</span>
|
|
941
1007
|
|
|
942
1008
|
<span class='kw'>def</span> <span class='id identifier rubyid_jsonapi_update'>jsonapi_update</span>
|
|
943
1009
|
<span class='id identifier rubyid__persist'>_persist</span> <span class='kw'>do</span>
|
|
944
|
-
<span class='id identifier
|
|
1010
|
+
<span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span><span class='period'>.</span><span class='id identifier rubyid_persist_with_relationships'>persist_with_relationships</span> \
|
|
945
1011
|
<span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_meta'>meta</span><span class='comma'>,</span>
|
|
946
1012
|
<span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='comma'>,</span>
|
|
947
1013
|
<span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_relationships'>relationships</span>
|
|
@@ -1011,7 +1077,7 @@ back the transaction.</p>
|
|
|
1011
1077
|
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 74</span>
|
|
1012
1078
|
|
|
1013
1079
|
<span class='kw'>def</span> <span class='id identifier rubyid_query'>query</span>
|
|
1014
|
-
<span class='ivar'>@query</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Query.html" title="JsonapiCompliable::Query (class)">Query</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Query.html#initialize-instance_method" title="JsonapiCompliable::Query#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier
|
|
1080
|
+
<span class='ivar'>@query</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Query.html" title="JsonapiCompliable::Query (class)">Query</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Query.html#initialize-instance_method" title="JsonapiCompliable::Query#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
|
1015
1081
|
<span class='kw'>end</span></pre>
|
|
1016
1082
|
</td>
|
|
1017
1083
|
</tr>
|
|
@@ -1078,7 +1144,7 @@ resource</p>
|
|
|
1078
1144
|
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 80</span>
|
|
1079
1145
|
|
|
1080
1146
|
<span class='kw'>def</span> <span class='id identifier rubyid_query_hash'>query_hash</span>
|
|
1081
|
-
<span class='ivar'>@query_hash</span> <span class='op'>||=</span> <span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span><span class='lbracket'>[</span><span class='id identifier
|
|
1147
|
+
<span class='ivar'>@query_hash</span> <span class='op'>||=</span> <span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span>
|
|
1082
1148
|
<span class='kw'>end</span></pre>
|
|
1083
1149
|
</td>
|
|
1084
1150
|
</tr>
|
|
@@ -1217,17 +1283,17 @@ avoid this, pass <tt>scope: false</tt></p>
|
|
|
1217
1283
|
<pre class="lines">
|
|
1218
1284
|
|
|
1219
1285
|
|
|
1286
|
+
218
|
|
1287
|
+
219
|
|
1220
1288
|
220
|
|
1221
1289
|
221
|
|
1222
1290
|
222
|
|
1223
1291
|
223
|
|
1224
1292
|
224
|
|
1225
|
-
225
|
|
1226
|
-
226
|
|
1227
|
-
227</pre>
|
|
1293
|
+
225</pre>
|
|
1228
1294
|
</td>
|
|
1229
1295
|
<td>
|
|
1230
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line
|
|
1296
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 218</span>
|
|
1231
1297
|
|
|
1232
1298
|
<span class='kw'>def</span> <span class='id identifier rubyid_render_jsonapi'>render_jsonapi</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
1233
1299
|
<span class='id identifier rubyid_scope'>scope</span> <span class='op'>=</span> <span class='id identifier rubyid_jsonapi_scope'>jsonapi_scope</span><span class='lparen'>(</span><span class='id identifier rubyid_scope'>scope</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:scope</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='kw'>false</span> <span class='op'>||</span> <span class='id identifier rubyid_scope'>scope</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</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="Scope.html" title="JsonapiCompliable::Scope (class)">Scope</a></span></span><span class='rparen'>)</span>
|
|
@@ -1240,72 +1306,6 @@ avoid this, pass <tt>scope: false</tt></p>
|
|
|
1240
1306
|
</td>
|
|
1241
1307
|
</tr>
|
|
1242
1308
|
</table>
|
|
1243
|
-
</div>
|
|
1244
|
-
|
|
1245
|
-
<div class="method_details ">
|
|
1246
|
-
<h3 class="signature " id="resource-instance_method">
|
|
1247
|
-
|
|
1248
|
-
#<strong>resource</strong> ⇒ <tt><span class='object_link'><a href="Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt>
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
</h3><div class="docstring">
|
|
1255
|
-
<div class="discussion">
|
|
1256
|
-
|
|
1257
|
-
<p>Returns an instance of the associated Resource</p>
|
|
1258
|
-
|
|
1259
|
-
<p>In other words, if you configured your controller as:</p>
|
|
1260
|
-
|
|
1261
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_jsonapi'>jsonapi</span> <span class='label'>resource:</span> <span class='const'>MyResource</span>
|
|
1262
|
-
</code></pre>
|
|
1263
|
-
|
|
1264
|
-
<p>This returns MyResource.new</p>
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
</div>
|
|
1268
|
-
</div>
|
|
1269
|
-
<div class="tags">
|
|
1270
|
-
|
|
1271
|
-
<p class="tag_title">Returns:</p>
|
|
1272
|
-
<ul class="return">
|
|
1273
|
-
|
|
1274
|
-
<li>
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
<span class='type'>(<tt><span class='object_link'><a href="Resource.html" title="JsonapiCompliable::Resource (class)">Resource</a></span></tt>)</span>
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
—
|
|
1282
|
-
<div class='inline'>
|
|
1283
|
-
<p>the configured Resource for this controller</p>
|
|
1284
|
-
</div>
|
|
1285
|
-
|
|
1286
|
-
</li>
|
|
1287
|
-
|
|
1288
|
-
</ul>
|
|
1289
|
-
|
|
1290
|
-
</div><table class="source_code">
|
|
1291
|
-
<tr>
|
|
1292
|
-
<td>
|
|
1293
|
-
<pre class="lines">
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
66
|
|
1297
|
-
67
|
|
1298
|
-
68</pre>
|
|
1299
|
-
</td>
|
|
1300
|
-
<td>
|
|
1301
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 66</span>
|
|
1302
|
-
|
|
1303
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_resource'>resource</span>
|
|
1304
|
-
<span class='ivar'>@resource</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid__jsonapi_compliable'>_jsonapi_compliable</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
1305
|
-
<span class='kw'>end</span></pre>
|
|
1306
|
-
</td>
|
|
1307
|
-
</tr>
|
|
1308
|
-
</table>
|
|
1309
1309
|
</div>
|
|
1310
1310
|
|
|
1311
1311
|
<div class="method_details ">
|
|
@@ -1361,18 +1361,14 @@ Helpful for easy-access to things like the current user.</p>
|
|
|
1361
1361
|
91
|
|
1362
1362
|
92
|
|
1363
1363
|
93
|
|
1364
|
-
94
|
|
1365
|
-
95
|
|
1366
|
-
96</pre>
|
|
1364
|
+
94</pre>
|
|
1367
1365
|
</td>
|
|
1368
1366
|
<td>
|
|
1369
1367
|
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/base.rb', line 90</span>
|
|
1370
1368
|
|
|
1371
1369
|
<span class='kw'>def</span> <span class='id identifier rubyid_wrap_context'>wrap_context</span>
|
|
1372
|
-
<span class='
|
|
1373
|
-
<span class='
|
|
1374
|
-
<span class='kw'>yield</span>
|
|
1375
|
-
<span class='kw'>end</span>
|
|
1370
|
+
<span class='id identifier rubyid_jsonapi_resource'>jsonapi_resource</span><span class='period'>.</span><span class='id identifier rubyid_with_context'>with_context</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
1371
|
+
<span class='kw'>yield</span>
|
|
1376
1372
|
<span class='kw'>end</span>
|
|
1377
1373
|
<span class='kw'>end</span></pre>
|
|
1378
1374
|
</td>
|
|
@@ -1385,7 +1381,7 @@ Helpful for easy-access to things like the current user.</p>
|
|
|
1385
1381
|
</div>
|
|
1386
1382
|
|
|
1387
1383
|
<div id="footer">
|
|
1388
|
-
Generated on
|
|
1384
|
+
Generated on Wed Jun 7 10:15:09 2017 by
|
|
1389
1385
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1390
1386
|
0.9.9 (ruby-2.3.0).
|
|
1391
1387
|
</div>
|
|
@@ -193,6 +193,30 @@ can track the object it just created. Expect this in <code>meta</code>:</p>
|
|
|
193
193
|
<p>The raw :attributes hash + <code>id</code>.</p>
|
|
194
194
|
</div></span>
|
|
195
195
|
|
|
196
|
+
</li>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
<li class="public ">
|
|
200
|
+
<span class="summary_signature">
|
|
201
|
+
|
|
202
|
+
<a href="#attributes=-instance_method" title="#attributes= (instance method)">#<strong>attributes=</strong>(attrs) ⇒ Object </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>Override the attributes # @see #attributes.</p>
|
|
218
|
+
</div></span>
|
|
219
|
+
|
|
196
220
|
</li>
|
|
197
221
|
|
|
198
222
|
|
|
@@ -490,12 +514,53 @@ include directive like.</p>
|
|
|
490
514
|
|
|
491
515
|
<span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
|
|
492
516
|
<span class='ivar'>@attributes</span> <span class='op'>||=</span> <span class='id identifier rubyid_raw_attributes'>raw_attributes</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
|
493
|
-
<span class='id identifier rubyid_hash'>hash</span><span class='
|
|
517
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span> <span class='kw'>if</span> <span class='id identifier rubyid_id'>id</span>
|
|
494
518
|
<span class='kw'>end</span>
|
|
495
519
|
<span class='kw'>end</span></pre>
|
|
496
520
|
</td>
|
|
497
521
|
</tr>
|
|
498
522
|
</table>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
<div class="method_details ">
|
|
526
|
+
<h3 class="signature " id="attributes=-instance_method">
|
|
527
|
+
|
|
528
|
+
#<strong>attributes=</strong>(attrs) ⇒ <tt>Object</tt>
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
</h3><div class="docstring">
|
|
535
|
+
<div class="discussion">
|
|
536
|
+
|
|
537
|
+
<p>Override the attributes # @see #attributes</p>
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
</div>
|
|
541
|
+
</div>
|
|
542
|
+
<div class="tags">
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
</div><table class="source_code">
|
|
546
|
+
<tr>
|
|
547
|
+
<td>
|
|
548
|
+
<pre class="lines">
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
74
|
|
552
|
+
75
|
|
553
|
+
76</pre>
|
|
554
|
+
</td>
|
|
555
|
+
<td>
|
|
556
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line 74</span>
|
|
557
|
+
|
|
558
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_attributes='>attributes=</span><span class='lparen'>(</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
|
|
559
|
+
<span class='ivar'>@attributes</span> <span class='op'>=</span> <span class='id identifier rubyid_attrs'>attrs</span>
|
|
560
|
+
<span class='kw'>end</span></pre>
|
|
561
|
+
</td>
|
|
562
|
+
</tr>
|
|
563
|
+
</table>
|
|
499
564
|
</div>
|
|
500
565
|
|
|
501
566
|
<div class="method_details ">
|
|
@@ -667,18 +732,18 @@ include directive.</p>
|
|
|
667
732
|
<pre class="lines">
|
|
668
733
|
|
|
669
734
|
|
|
670
|
-
101
|
|
671
|
-
102
|
|
672
|
-
103
|
|
673
|
-
104
|
|
674
|
-
105
|
|
675
|
-
106
|
|
676
735
|
107
|
|
677
736
|
108
|
|
678
|
-
109
|
|
737
|
+
109
|
|
738
|
+
110
|
|
739
|
+
111
|
|
740
|
+
112
|
|
741
|
+
113
|
|
742
|
+
114
|
|
743
|
+
115</pre>
|
|
679
744
|
</td>
|
|
680
745
|
<td>
|
|
681
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line
|
|
746
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line 107</span>
|
|
682
747
|
|
|
683
748
|
<span class='kw'>def</span> <span class='id identifier rubyid_include_directive'>include_directive</span><span class='lparen'>(</span><span class='id identifier rubyid_memo'>memo</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_relationship_node'>relationship_node</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
684
749
|
<span class='id identifier rubyid_relationship_node'>relationship_node</span> <span class='op'>||=</span> <span class='id identifier rubyid_relationships'>relationships</span>
|
|
@@ -738,16 +803,16 @@ create/update/destroy/disassociate. Based on the request env or the
|
|
|
738
803
|
<pre class="lines">
|
|
739
804
|
|
|
740
805
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
806
|
+
85
|
|
807
|
+
86
|
|
808
|
+
87
|
|
809
|
+
88
|
|
810
|
+
89
|
|
811
|
+
90
|
|
812
|
+
91</pre>
|
|
748
813
|
</td>
|
|
749
814
|
<td>
|
|
750
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line
|
|
815
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line 85</span>
|
|
751
816
|
|
|
752
817
|
<span class='kw'>def</span> <span class='id identifier rubyid_meta'>meta</span>
|
|
753
818
|
<span class='lbrace'>{</span>
|
|
@@ -805,12 +870,12 @@ create/update/destroy/disassociate. Based on the request env or the
|
|
|
805
870
|
<pre class="lines">
|
|
806
871
|
|
|
807
872
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
873
|
+
94
|
|
874
|
+
95
|
|
875
|
+
96</pre>
|
|
811
876
|
</td>
|
|
812
877
|
<td>
|
|
813
|
-
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line
|
|
878
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/deserializer.rb', line 94</span>
|
|
814
879
|
|
|
815
880
|
<span class='kw'>def</span> <span class='id identifier rubyid_relationships'>relationships</span>
|
|
816
881
|
<span class='ivar'>@relationships</span> <span class='op'>||=</span> <span class='id identifier rubyid_process_relationships'>process_relationships</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_relationships'>raw_relationships</span><span class='rparen'>)</span>
|
|
@@ -825,7 +890,7 @@ create/update/destroy/disassociate. Based on the request env or the
|
|
|
825
890
|
</div>
|
|
826
891
|
|
|
827
892
|
<div id="footer">
|
|
828
|
-
Generated on
|
|
893
|
+
Generated on Wed Jun 7 10:15:10 2017 by
|
|
829
894
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
830
895
|
0.9.9 (ruby-2.3.0).
|
|
831
896
|
</div>
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
<div id="footer">
|
|
117
|
-
Generated on
|
|
117
|
+
Generated on Wed Jun 7 10:15:09 2017 by
|
|
118
118
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
119
119
|
0.9.9 (ruby-2.3.0).
|
|
120
120
|
</div>
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
</div>
|
|
257
257
|
|
|
258
258
|
<div id="footer">
|
|
259
|
-
Generated on
|
|
259
|
+
Generated on Wed Jun 7 10:15:09 2017 by
|
|
260
260
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
261
261
|
0.9.9 (ruby-2.3.0).
|
|
262
262
|
</div>
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
</div>
|
|
255
255
|
|
|
256
256
|
<div id="footer">
|
|
257
|
-
Generated on
|
|
257
|
+
Generated on Wed Jun 7 10:15:09 2017 by
|
|
258
258
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
259
259
|
0.9.9 (ruby-2.3.0).
|
|
260
260
|
</div>
|