jsonapi-serializers 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/jsonapi-serializers/serializer.rb +1 -1
- data/lib/jsonapi-serializers/version.rb +1 -1
- data/spec/serializer_spec.rb +1 -4
- 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: 3eaa17fccc55ae5a39942e835dbe6d96745d8144
|
4
|
+
data.tar.gz: 49169f889acb1f9e0a13b575a6a9f099d9080ac3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a914aca7d66506a91c2a879b30b192d8dcfadcec44744e3ba42494ea36613fbf22c2ea9240602b1784b9c272f7307109ac9c383c2010e0a6f5cb19a3ae2993
|
7
|
+
data.tar.gz: 5e309c05b09a6edb29a57d1fe7452656e9c471749ae85a79f4c2348dced312418c5adf08cd5ccc42ccb57bb9f3e6b72b02273f441e5419331f9e17e9700273f9
|
data/README.md
CHANGED
@@ -606,7 +606,7 @@ module Api
|
|
606
606
|
def parse_request_body
|
607
607
|
request.body.rewind
|
608
608
|
|
609
|
-
case request.content_type
|
609
|
+
case request.content_type && request.content_type[/^([^;]+)/]
|
610
610
|
when /json$/, /javascript$/
|
611
611
|
JSON.parse(request.body.read, symbolize_names: true)
|
612
612
|
end
|
@@ -636,7 +636,7 @@ module Api
|
|
636
636
|
end
|
637
637
|
|
638
638
|
get '/posts/:id', provides: :jsonapi do
|
639
|
-
post = Post[params[:id]]
|
639
|
+
post = Post[params[:id].to_i]
|
640
640
|
not_found if post.nil?
|
641
641
|
serialize_model(post, include: 'comments').to_json
|
642
642
|
end
|
@@ -652,6 +652,7 @@ end
|
|
652
652
|
|
653
653
|
## Release notes
|
654
654
|
|
655
|
+
* v0.6.4: Fix regression of including links when empty.
|
655
656
|
* v0.6.3: Fix support for underscore-formatted attribute names.
|
656
657
|
* v0.6.2: Internal style updates and performance fixes.
|
657
658
|
* v0.6.1: Spec compliance fix, include intermediate resources on compound documents.
|
@@ -332,7 +332,7 @@ module JSONAPI
|
|
332
332
|
relationships = serializer.relationships
|
333
333
|
meta = serializer.meta
|
334
334
|
data['attributes'] = attributes if !attributes.nil?
|
335
|
-
data['links'] = links if !links.
|
335
|
+
data['links'] = links if !links.empty?
|
336
336
|
data['relationships'] = relationships if !relationships.empty?
|
337
337
|
data['meta'] = meta if !meta.nil?
|
338
338
|
data
|
data/spec/serializer_spec.rb
CHANGED
@@ -107,7 +107,7 @@ describe JSONAPI::Serializer do
|
|
107
107
|
},
|
108
108
|
})
|
109
109
|
end
|
110
|
-
it 'does not include links if
|
110
|
+
it 'does not include relationship links if relationship_{self_link,_related_link} are nil' do
|
111
111
|
post = create(:post)
|
112
112
|
primary_data = serialize_primary(post, {serializer: MyApp::PostSerializerWithoutLinks})
|
113
113
|
expect(primary_data).to eq({
|
@@ -117,9 +117,6 @@ describe JSONAPI::Serializer do
|
|
117
117
|
'title' => 'Title for Post 1',
|
118
118
|
'long-content' => 'Body for Post 1',
|
119
119
|
},
|
120
|
-
'links' => {
|
121
|
-
'self' => '/posts/1',
|
122
|
-
},
|
123
120
|
# This is technically invalid since relationships MUST contain at least one of links,
|
124
121
|
# data, or meta, but we leave that up to the user.
|
125
122
|
'relationships' => {
|
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.6.
|
4
|
+
version: 0.6.4
|
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-
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|