jsonapi-realizer 6.1.3 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonapi/realizer/controller.rb +2 -2
- data/lib/jsonapi/realizer/error/invalid_accept_type_header.rb +2 -1
- data/lib/jsonapi/realizer/error/invalid_content_type_header.rb +2 -1
- data/lib/jsonapi/realizer/resource.rb +2 -6
- data/lib/jsonapi/realizer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 916d37b9e745362ffe32ecb2714d9a3189bdf42ff25b5003418b0322fd8f13c3
|
4
|
+
data.tar.gz: 50802e7b49a6d5fb1cec608971081f8780068190a7c444ea1d34b4e212a5cc2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3889bbacc408251a944c9950f3cb4dd7eae46e6f12c66b422c67bf33ce60dde0d45c95db318f492a16a12a9606b731167607a10b516cb74fe40fd25d4d14632
|
7
|
+
data.tar.gz: 2e096623acc9d4cc1ba48bb5c0f1c6364253ccd1d81cfabe73832a8ecfaba21c8197d61a5d90627fd66a374d1255961dcdc7125ba691c6bbd78af7e6655bff4a
|
@@ -15,7 +15,7 @@ module JSONAPI
|
|
15
15
|
|
16
16
|
return if request.headers.fetch("HTTP_ACCEPT").include?(JSONAPI::MEDIA_TYPE)
|
17
17
|
|
18
|
-
raise(JSONAPI::Realizer.configuration.default_invalid_accept_type_exception)
|
18
|
+
raise(JSONAPI::Realizer.configuration.default_invalid_accept_type_exception, given: request.headers.fetch("HTTP_ACCEPT"), wanted: JSONAPI::MEDIA_TYPE, key: "Accept")
|
19
19
|
end
|
20
20
|
|
21
21
|
private def reject_missing_content_type_header
|
@@ -30,7 +30,7 @@ module JSONAPI
|
|
30
30
|
|
31
31
|
return if request.headers.fetch("Content-Type").include?(JSONAPI::MEDIA_TYPE)
|
32
32
|
|
33
|
-
raise(JSONAPI::Realizer.configuration.default_invalid_content_type_exception)
|
33
|
+
raise(JSONAPI::Realizer.configuration.default_invalid_content_type_exception, given: request.headers.fetch("Content-Type"), wanted: JSONAPI::MEDIA_TYPE, key: "Content-Type")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -4,11 +4,12 @@ module JSONAPI
|
|
4
4
|
module Realizer
|
5
5
|
class Error
|
6
6
|
class InvalidAcceptTypeHeader < Error
|
7
|
+
attr_accessor(:key)
|
7
8
|
attr_accessor(:given)
|
8
9
|
attr_accessor(:wanted)
|
9
10
|
|
10
11
|
def message
|
11
|
-
"HTTP
|
12
|
+
"HTTP #{key} Header recieved is #{given}, but expected #{wanted}"
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -4,11 +4,12 @@ module JSONAPI
|
|
4
4
|
module Realizer
|
5
5
|
class Error
|
6
6
|
class InvalidContentTypeHeader < Error
|
7
|
+
attr_accessor(:key)
|
7
8
|
attr_accessor(:given)
|
8
9
|
attr_accessor(:wanted)
|
9
10
|
|
10
11
|
def message
|
11
|
-
"HTTP
|
12
|
+
"HTTP #{key} Header recieved is #{given}, but expected #{wanted}"
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -167,19 +167,15 @@ module JSONAPI
|
|
167
167
|
end
|
168
168
|
|
169
169
|
def attributes
|
170
|
-
return unless data.key?("attributes")
|
171
|
-
|
172
170
|
@attributes ||= data
|
173
|
-
.fetch("attributes")
|
171
|
+
.fetch("attributes", {})
|
174
172
|
.transform_keys(&:underscore)
|
175
173
|
.transform_keys { |key| attribute(key).as }
|
176
174
|
end
|
177
175
|
|
178
176
|
def relationships
|
179
|
-
return unless data.key?("relationships")
|
180
|
-
|
181
177
|
@relationships ||= data
|
182
|
-
.fetch("relationships")
|
178
|
+
.fetch("relationships", {})
|
183
179
|
.transform_keys(&:underscore)
|
184
180
|
.map(&method(:as_relationship)).to_h
|
185
181
|
.transform_keys { |key| relation(key).as }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-realizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurtis Rainbolt-Greene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|