jsonapi-serializers 0.2.2 → 0.2.3
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 +4 -4
- data/README.md +1 -0
- data/lib/jsonapi-serializers/serializer.rb +1 -0
- data/lib/jsonapi-serializers/version.rb +1 -1
- data/spec/serializer_spec.rb +12 -0
- data/spec/support/serializers.rb +4 -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: 0ecd4a38af955857a58bcadcdf88ef7e2f658f82
|
4
|
+
data.tar.gz: b47bc0a6ce3a5732d3f76bea5f87d425664afc9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84839b9fa483ad6cff15f7c152045ba5e78c0aed12e354898b80d1532350b4d5eefa05d45ee686ac402adf8c7e613fcb7cbb96aadd80b8d0c6b50b498e0ce6e7
|
7
|
+
data.tar.gz: afe84502165a840780bd94f54974a41a568f13e1c55efce92d21f7accb26c7aa07fbe30b2badff09eba60e4ca0b63637daa5864c4360fac3e8dfbdefe6b253e6
|
data/README.md
CHANGED
@@ -429,6 +429,7 @@ end
|
|
429
429
|
|
430
430
|
## Release notes
|
431
431
|
|
432
|
+
* v0.2.3: Support serializers with no attributes.
|
432
433
|
* v0.2.2: Compliance fix for excluding empty relationship objects.
|
433
434
|
* v0.2.1: Compliance fix for self links.
|
434
435
|
* v0.2.0: Initial release with support for the final v1 JSON API spec.
|
@@ -139,6 +139,7 @@ module JSONAPI
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def attributes
|
142
|
+
return {} if self.class.attributes_map.nil?
|
142
143
|
attributes = {}
|
143
144
|
self.class.attributes_map.each do |attribute_name, attr_data|
|
144
145
|
next if !should_include_attr?(attr_data[:options][:if], attr_data[:options][:unless])
|
data/spec/serializer_spec.rb
CHANGED
@@ -275,6 +275,18 @@ describe JSONAPI::Serializer do
|
|
275
275
|
})
|
276
276
|
end
|
277
277
|
end
|
278
|
+
it 'can serialize primary data for an empty serializer with no attributes' do
|
279
|
+
post = create(:post)
|
280
|
+
primary_data = serialize_primary(post, {serializer: MyApp::EmptySerializer})
|
281
|
+
expect(primary_data).to eq({
|
282
|
+
'id' => '1',
|
283
|
+
'type' => 'posts',
|
284
|
+
'attributes' => {},
|
285
|
+
'links' => {
|
286
|
+
'self' => '/posts/1',
|
287
|
+
},
|
288
|
+
})
|
289
|
+
end
|
278
290
|
end
|
279
291
|
|
280
292
|
describe 'JSONAPI::Serializer.serialize' do
|
data/spec/support/serializers.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Fotinakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|