simple-json-api-serializer 0.4.0 → 0.5.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: e5df1c7cd4c2c8c860ec9819d9b746b61ff27d24
4
- data.tar.gz: 6000a8133259af0e33f0abc16e702536a8324bcb
3
+ metadata.gz: 90df64affc699d539a58910e01ec0dd02056af36
4
+ data.tar.gz: 09913c1d4a31f3ec04bb45f6e7d8091431bca710
5
5
  SHA512:
6
- metadata.gz: ca12d9d4e3fa0bff22ea271ceadf865e23a99dfd19ced074d4f798fc07e4a7b8dfb7a8b8105539d11d917a3c563094e46bc91f66349a2f034c7fe9abbb9697a9
7
- data.tar.gz: c16affcb28eaa535004cb934d0c89fe0f92d88acf039be48f0133ddcf94540cd16f9eda3eb8fdd431f22b4374940acb7a0089f0f1db274bff95e25faaf5aa4d8
6
+ metadata.gz: 5defc09dd54888da10cfddae2babb4a91d2909c21a05a11f9f61a3d3319b3e316a44dbb2c141c1c566702230214c2eb88bf6eec31271cdf7d87f94d36f54b289
7
+ data.tar.gz: e55c59d5d770f483a80b2e639a3583bd032bcc2529348c8788eebbd2fe1f5044099831d221fbdf18374c1a32f6d8131af311eba99aa623ed31d6145852f81054
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple-json-api-serializer (0.3.1)
4
+ simple-json-api-serializer (0.4.0)
5
5
  activesupport (~> 4.2)
6
6
 
7
7
  GEM
@@ -4,7 +4,7 @@ module JSONApi
4
4
  self.new.deserialize(data)
5
5
  end
6
6
 
7
- def deserialize(data)
7
+ def deserialize(data, **options)
8
8
  type = sanitize_type_name(data.fetch('type'))
9
9
 
10
10
  attributes = sanitize_hash(data.fetch('attributes', {}))
@@ -12,7 +12,11 @@ module JSONApi
12
12
 
13
13
  deserialize_relationships(relationships, attributes)
14
14
 
15
- { type => attributes }
15
+ if options[:root] == false
16
+ attributes
17
+ else
18
+ { type => attributes }
19
+ end
16
20
  end
17
21
 
18
22
  private
@@ -1,3 +1,3 @@
1
1
  module JSONApi
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-json-api-serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Schilstra