jsonapi-serializers 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: af8a0a05ecd47d8d0be5f72251cae5ea364014e9
4
- data.tar.gz: 93ddb5ff6bed3e4269f25323f2ba59e4978e710e
2
+ SHA256:
3
+ metadata.gz: 0fd9ca8b21d90e0ca99ef6d7c9930e1b6ba9a370e96bf1d0e9cb76b24cf96b34
4
+ data.tar.gz: '079ac81b6b1a1c99ed075c2479ddd142f3f7db6552a86834201bcb1a0d6de5ff'
5
5
  SHA512:
6
- metadata.gz: 3feeaadfb08984abbfea5b42359e80fb3df7444addf66d24f0d3cc9eb75c0dd403ad8fd1042901233d31f1b80380a6cc70fcac005b8a72e077d5c5608efb0b88
7
- data.tar.gz: 71111c0ffc7b61527a0a9eba1db3f8492c2084950cd4b70c725313e7504a2049808e50899f240fcbe3e4ce709289764281a4b99e4464b638eafdeba3eb0fa6a3
6
+ metadata.gz: bfb423c4750432656c8937c52c6dfd0598f32d9548688f5e3b01c90eb08433cb88a29a5dba7bff0c07a91d64a50b0ceae2c416f9f0b14a46254dd315dc992be9
7
+ data.tar.gz: 9988ef3702519bdc37a40e46f1c9ee28fd1133b94a84f6dfe296feeed668e50f082cd2dd1cb96ed330598e2722d074da4e48808afa41cab81472758cd457d424
@@ -304,8 +304,8 @@ module JSONAPI
304
304
 
305
305
  # Automatically include linkage data for any relation that is also included.
306
306
  if includes
307
- direct_children_includes = includes.reject { |key| key.include?('.') }
308
- passthrough_options[:include_linkages] = direct_children_includes
307
+ include_linkages = includes.map { |key| key.to_s.split('.').first }
308
+ passthrough_options[:include_linkages] = include_linkages
309
309
  end
310
310
 
311
311
  # Spec: Primary data MUST be either:
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Serializer
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
@@ -708,7 +708,10 @@ describe JSONAPI::Serializer do
708
708
  long_comments.each { |c| c.post = post }
709
709
 
710
710
  expected_data = {
711
- 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}),
711
+ 'data' => serialize_primary(post, {
712
+ serializer: MyApp::PostSerializer,
713
+ include_linkages: ['long-comments']
714
+ }),
712
715
  'included' => [
713
716
  # Intermediates are included: long-comments, long-comments.post, and long-comments.post.author
714
717
  # http://jsonapi.org/format/#document-structure-compound-documents
@@ -745,7 +748,10 @@ describe JSONAPI::Serializer do
745
748
  long_comments.each { |c| c.post = post }
746
749
 
747
750
  expected_data = {
748
- 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}),
751
+ 'data' => serialize_primary(post, {
752
+ serializer: MyApp::PostSerializer,
753
+ include_linkages: ['long-comments']
754
+ }),
749
755
  'included' => [
750
756
  serialize_primary(first_comment, {
751
757
  serializer: MyApp::LongCommentSerializer,
@@ -788,7 +794,7 @@ describe JSONAPI::Serializer do
788
794
  serialize_primary(comment_user, {serializer: MyAppOtherNamespace::UserSerializer}),
789
795
  ],
790
796
  }
791
- includes = ['long-comments', 'long-comments.user']
797
+ includes = ['long-comments.user']
792
798
  actual_data = JSONAPI::Serializer.serialize(post, include: includes)
793
799
 
794
800
  # Multiple expectations for better diff output for debugging.
@@ -826,7 +832,7 @@ describe JSONAPI::Serializer do
826
832
  ],
827
833
  }
828
834
  # Also test that it handles string include arguments.
829
- includes = 'long-comments, long-comments.post.author'
835
+ includes = 'long-comments,long-comments.post.author'
830
836
  actual_data = JSONAPI::Serializer.serialize(post, include: includes)
831
837
 
832
838
  # Multiple expectations for better diff output for debugging.
@@ -1197,7 +1203,10 @@ describe JSONAPI::Serializer do
1197
1203
  long_comments.each { |c| c.post = post }
1198
1204
 
1199
1205
  expected_data = {
1200
- 'data' => serialize_primary(post, {serializer: Api::V1::MyApp::PostSerializer}),
1206
+ 'data' => serialize_primary(post, {
1207
+ serializer: Api::V1::MyApp::PostSerializer,
1208
+ include_linkages: ['long-comments']
1209
+ }),
1201
1210
  'included' => [
1202
1211
  # Intermediates are included: long-comments, long-comments.post, and long-comments.post.author
1203
1212
  # http://jsonapi.org/format/#document-structure-compound-documents
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Fotinakis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-08 00:00:00.000000000 Z
11
+ date: 2018-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.6.7
140
+ rubygems_version: 2.7.6
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Pure Ruby readonly serializers for the JSON:API spec.