jsonapi-serializers 0.12.0 → 0.13.0

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: 7cff13da1ad649652014dfc451176436fcde50ba
4
- data.tar.gz: 46c974244da10f13881c8a0de5ea63eec2c2ec04
3
+ metadata.gz: ac6048277d2389daf1b9a46079531c7098ff4ec4
4
+ data.tar.gz: 35480667be2ae7cedd19b756d6f347d2a7874caa
5
5
  SHA512:
6
- metadata.gz: 2746b67e07e94155403e8740932d8f0a6f0df161208e6a3602346be71350cb0cd11b84dfb3d710e8008cf5582650b6f2e25058286aba8984be92acf95be479bd
7
- data.tar.gz: dcc38f840609ef7730e7c84f11bc613092935b156b1786cb16b9314caafe8d1d9854b2d40c376badf0a447fcc6f031074a364e0e45625c0cac2338a17c710d99
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.
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Serializer
3
- VERSION = '0.12.0'
3
+ VERSION = '0.13.0'
4
4
  end
5
5
  end
@@ -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.12.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-20 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport