jsonapi_compliable 0.11.30 → 0.11.31
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/lib/jsonapi_compliable/base.rb +1 -1
- data/lib/jsonapi_compliable/deserializer.rb +11 -2
- data/lib/jsonapi_compliable/version.rb +1 -1
- 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: 76109d783e52c411bd1ed7583bd94f50478f7605
|
4
|
+
data.tar.gz: f3d5581fbbda759b055219c454d8a2060dc879b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed2ef49d65ba39ba4255a599886e93255afb03d654efa45ca820f561399fff83eed54cc0e536da49d0335f7a6b7d4b4832452bdaed1ab76e511442cec769e0d
|
7
|
+
data.tar.gz: 0f95a5e83ea0a23b570dcf84b44f552b8d1536826e3331815ebec4d28da307fb2c32331527ab7451ae5fcc0675f9f5c2511c4c65c438d3668c1db64036e35741
|
@@ -48,14 +48,23 @@ class JsonapiCompliable::Deserializer
|
|
48
48
|
# @param payload [Hash] The incoming payload with symbolized keys
|
49
49
|
# @param env [Hash] the Rack env (e.g. +request.env+).
|
50
50
|
def initialize(payload, env)
|
51
|
-
@payload = payload
|
51
|
+
@payload = payload || {}
|
52
52
|
@payload = @payload[:_jsonapi] if @payload.has_key?(:_jsonapi)
|
53
53
|
@env = env
|
54
|
+
validate_content_type
|
55
|
+
end
|
56
|
+
|
57
|
+
# checks Content-Type header and prints a warning if it doesn't seem correct
|
58
|
+
def validate_content_type
|
59
|
+
content_type = @env['CONTENT_TYPE'] || ""
|
60
|
+
if !(content_type.include?("application/json") || content_type.include?("application/vnd.api+json"))
|
61
|
+
print("WARNING - JSONAPI Compliable :: Content-Type header appears to be set to an invalid value: #{content_type}\n")
|
62
|
+
end
|
54
63
|
end
|
55
64
|
|
56
65
|
# @return [Hash] the raw :data value of the payload
|
57
66
|
def data
|
58
|
-
@payload[:data]
|
67
|
+
@payload[:data] || {}
|
59
68
|
end
|
60
69
|
|
61
70
|
# @return [String] the raw :id value of the payload
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_compliable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-09-
|
12
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jsonapi-serializable
|