json_api_ruby 0.4.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0061d47ce650e9fcb4fb372e55830c44ffc2ee84
4
- data.tar.gz: e21dcd60e6302c6cfc8c206fcd84cf15fad78ddb
3
+ metadata.gz: 553e6121c4ac702e386b7067fd9804f812194799
4
+ data.tar.gz: 69a294d2141961b38d23a6c2514d6cb2be856edd
5
5
  SHA512:
6
- metadata.gz: 955e5c106e646ca173aa3b31b3f292abdc43d3122928aa856a52f7d09354d97f818b530a03e2cacfb7cf931341e9886f4664ea9205c4dc0525f2bcbfc8f59b94
7
- data.tar.gz: c3e643b234cf81c68b5bbbcc0924f128e5364ec4500807c4d9b69eb71090dc84d9e67d755176ede994ec4cbe106a3628ba27925073e002d73d14b06a2a75e6e4
6
+ metadata.gz: 697915cbc2cd202ee758cdffc3e5f4dfc837ec34ac6009786d1d4a14464803395a7ef010e0b00ad6cc20b638328a449743b4d4fda08e740c518f5d96b906fcaa
7
+ data.tar.gz: 15d36f22c41d4a494744fd8480be08f337c7a2033d59529c5d2fc2d5e7da62b28c6f1e884ba28f0b6ca5e249b20800275d5c6b06867227bafcbf68abc9fd18bc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.2
2
+ Fixed an issue where serializing a collection with `include` options could result in duplicate
3
+ data returned in the `included` key
4
+
1
5
  0.4.1
2
6
  Some major refactoring but no backwards compatibility breaking functionality
3
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json_api_ruby (0.3.0)
4
+ json_api_ruby (0.4.2)
5
5
  activesupport (~> 3)
6
6
 
7
7
  GEM
@@ -44,7 +44,12 @@ module JsonApi
44
44
  included_resources = object_resource.relationships.select {|rel| rel.included?}.flat_map {|rel| rel.resources }
45
45
  included_resources += included_resources.flat_map {|res| find_included_resources(res) }
46
46
  included_resources.flatten
47
- included_resources.uniq { |rel| rel.id + rel.type }
47
+ unique_identifiers!(included_resources)
48
+ end
49
+
50
+ def unique_identifiers!(resources)
51
+ resources.uniq! { |rel| rel.id + rel.type }
52
+ resources
48
53
  end
49
54
  end
50
55
 
@@ -74,6 +79,7 @@ module JsonApi
74
79
  data_array = Array(@object).map do |object|
75
80
  object_resource = resource(object)
76
81
  included_resources += find_included_resources(object_resource)
82
+ unique_identifiers!(included_resources)
77
83
  object_resource.to_hash
78
84
  end
79
85
 
@@ -1,3 +1,3 @@
1
1
  module JsonApi
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -99,6 +99,8 @@ RSpec.describe JsonApi::Serializer do
99
99
 
100
100
  context 'with included resources' do
101
101
  subject(:serialized_resources) do
102
+ people.first.articles << people.second.articles.first
103
+ people.second.articles << people.first.articles.first
102
104
  JsonApi.serialize(people, meta: {'I' => 'have meta'}, include: [:articles])
103
105
  end
104
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tracey Eubanks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport