simple_jsonapi_rails 1.2.0 → 1.3.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9758a0f3fd06b470a59b9ab25ca7817645864ac816733172b63671fee1c3a4f
|
4
|
+
data.tar.gz: 24ff4b62b70c2883605e6440ee88306869b5c45e4c69ff6220a64fb28f85e3c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30ca70b05fc1f6fd927a360ea94c94ac80b7d18320a5d89c1e0b806831c3597296f4d4805e3148732bedd20dc3edcd0d135c22c932049c32e324d9d59004a2f4
|
7
|
+
data.tar.gz: 4e94601dfcd208569e1cbfeb8691e6198f08d7569445220e7d974e43223eb336a036c86322c9a4d55be382d78a19e69886c45cf68589a2f5b67c1b0b8b4b79ab
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ module SimpleJsonapi
|
|
4
4
|
class RequestValidator
|
5
5
|
attr_reader :request, :params
|
6
6
|
|
7
|
-
delegate :body, :content_type, :accept, :path, to: :request, prefix: true
|
7
|
+
delegate :body, :content_type, :media_type, :accept, :path, to: :request, prefix: true
|
8
8
|
|
9
9
|
def initialize(request, params)
|
10
10
|
@request = request
|
@@ -12,7 +12,11 @@ module SimpleJsonapi
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def valid_content_type_header?
|
15
|
-
|
15
|
+
if request.respond_to?(:media_type)
|
16
|
+
!request_has_body? || request_media_type == SimpleJsonapi::MIME_TYPE
|
17
|
+
else
|
18
|
+
!request_has_body? || request_content_type == SimpleJsonapi::MIME_TYPE
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def valid_accept_header?
|
@@ -14,17 +14,32 @@ module SimpleJsonapi
|
|
14
14
|
# In the renderers, `self` is the controller
|
15
15
|
|
16
16
|
::ActionController::Renderers.add(:jsonapi_resource) do |resource, options|
|
17
|
-
|
17
|
+
if respond_to?(:media_type)
|
18
|
+
self.content_type = Mime[:jsonapi] unless self.media_type
|
19
|
+
else
|
20
|
+
self.content_type ||= Mime[:jsonapi]
|
21
|
+
end
|
22
|
+
|
18
23
|
SimpleJsonapi.render_resource(resource, options).to_json
|
19
24
|
end
|
20
25
|
|
21
26
|
::ActionController::Renderers.add(:jsonapi_resources) do |resources, options|
|
22
|
-
|
27
|
+
if respond_to?(:media_type)
|
28
|
+
self.content_type = Mime[:jsonapi] unless self.media_type
|
29
|
+
else
|
30
|
+
self.content_type ||= Mime[:jsonapi]
|
31
|
+
end
|
32
|
+
|
23
33
|
SimpleJsonapi.render_resources(resources, options).to_json
|
24
34
|
end
|
25
35
|
|
26
36
|
::ActionController::Renderers.add(:jsonapi_errors) do |errors, options|
|
27
|
-
|
37
|
+
if respond_to?(:media_type)
|
38
|
+
self.content_type = Mime[:jsonapi] unless self.media_type
|
39
|
+
else
|
40
|
+
self.content_type ||= Mime[:jsonapi]
|
41
|
+
end
|
42
|
+
|
28
43
|
SimpleJsonapi.render_errors(errors, options).to_json
|
29
44
|
end
|
30
45
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_jsonapi_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PatientsLikeMe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simple_jsonapi
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- test/action_controller_test.rb
|
235
235
|
- test/dummy/.gitignore
|
236
236
|
- test/dummy/Rakefile
|
237
|
+
- test/dummy/app/assets/config/manifest.js
|
237
238
|
- test/dummy/app/controllers/api_controller.rb
|
238
239
|
- test/dummy/app/controllers/orders/relationships/items_controller.rb
|
239
240
|
- test/dummy/app/controllers/orders_controller.rb
|
@@ -280,8 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
281
|
- !ruby/object:Gem::Version
|
281
282
|
version: '0'
|
282
283
|
requirements: []
|
283
|
-
|
284
|
-
rubygems_version: 2.7.6
|
284
|
+
rubygems_version: 3.0.6
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: A library for integrating SimpleJsonapi into a Rails application.
|
@@ -289,6 +289,7 @@ test_files:
|
|
289
289
|
- test/action_controller_test.rb
|
290
290
|
- test/dummy/.gitignore
|
291
291
|
- test/dummy/Rakefile
|
292
|
+
- test/dummy/app/assets/config/manifest.js
|
292
293
|
- test/dummy/app/controllers/api_controller.rb
|
293
294
|
- test/dummy/app/controllers/orders/relationships/items_controller.rb
|
294
295
|
- test/dummy/app/controllers/orders_controller.rb
|