jsonapi-serializers 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonapi-serializers/serializer.rb +2 -0
- data/lib/jsonapi-serializers/version.rb +1 -1
- data/spec/serializer_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac6048277d2389daf1b9a46079531c7098ff4ec4
|
4
|
+
data.tar.gz: 35480667be2ae7cedd19b756d6f347d2a7874caa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a43a227c9e86df5366015e5c65236c1b076af5e798869aca1172038876b791d4316940047150f296e012cbd207a62a5543085991e40abdcf48005af0d5f614ae
|
7
|
+
data.tar.gz: 0e81e742972468dd6428c6107650bce9849bbab8cd8dce00976374aa10e336fc10b6f89ab0c154e010fbc1c87c1c90a2c4bb668f910d74a58aef41833cd9e715
|
@@ -241,6 +241,7 @@ module JSONAPI
|
|
241
241
|
options[:skip_collection_check] = options.delete('skip_collection_check') || options[:skip_collection_check] || false
|
242
242
|
options[:base_url] = options.delete('base_url') || options[:base_url]
|
243
243
|
options[:meta] = options.delete('meta') || options[:meta]
|
244
|
+
options[:links] = options.delete('links') || options[:links]
|
244
245
|
|
245
246
|
# Deprecated: use serialize_errors method instead
|
246
247
|
options[:errors] = options.delete('errors') || options[:errors]
|
@@ -294,6 +295,7 @@ module JSONAPI
|
|
294
295
|
'data' => primary_data,
|
295
296
|
}
|
296
297
|
result['meta'] = options[:meta] if options[:meta]
|
298
|
+
result['links'] = options[:links] if options[:links]
|
297
299
|
result['errors'] = options[:errors] if options[:errors]
|
298
300
|
|
299
301
|
# If 'include' relationships are given, recursively find and include each object.
|
data/spec/serializer_spec.rb
CHANGED
@@ -526,6 +526,14 @@ describe JSONAPI::Serializer do
|
|
526
526
|
'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}),
|
527
527
|
})
|
528
528
|
end
|
529
|
+
it 'can include a top level links node' do
|
530
|
+
post = create(:post)
|
531
|
+
links = {self: 'http://example.com/posts'}
|
532
|
+
expect(JSONAPI::Serializer.serialize(post, links: links)).to eq({
|
533
|
+
'links' => links,
|
534
|
+
'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}),
|
535
|
+
})
|
536
|
+
end
|
529
537
|
# TODO: remove this code on next major release
|
530
538
|
it 'can include a top level errors node - deprecated' do
|
531
539
|
post = create(:post)
|
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: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Fotinakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|