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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e720f6b16c3cb7ac850907d34061333a89ebc82
4
- data.tar.gz: 2702a9fc740389ea33fcecaf09693b66265ec4ff
3
+ metadata.gz: 3eaa17fccc55ae5a39942e835dbe6d96745d8144
4
+ data.tar.gz: 49169f889acb1f9e0a13b575a6a9f099d9080ac3
5
5
  SHA512:
6
- metadata.gz: 9a0fe500512489e94bc37fd9782eb47a0b00caea5cd9af124b8553db8984c1ca7cb16ea28cf3d34420065296b78a68ae0409bcd4c6af1d165a1136986f669320
7
- data.tar.gz: b89771e54eb2e45615b6c1c7dfeca693398aec729c27822276842a683cf7f3e5af7f6e4da89f947302983242ca0a69afc3caa387ecf0a3b13af1f03859d21157
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.nil?
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
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Serializer
3
- VERSION = '0.6.3'
3
+ VERSION = '0.6.4'
4
4
  end
5
5
  end
@@ -107,7 +107,7 @@ describe JSONAPI::Serializer do
107
107
  },
108
108
  })
109
109
  end
110
- it 'does not include links if relationship_self_link and relationship_related_link are nil' do
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' => {
@@ -131,6 +131,10 @@ module MyApp
131
131
  has_one :author
132
132
  has_many :long_comments
133
133
 
134
+ def self_link
135
+ nil
136
+ end
137
+
134
138
  def relationship_self_link(attribute_name)
135
139
  nil
136
140
  end
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.3
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-02-26 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport