jsonapi-realizer 6.1.2 → 6.2.0
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 +17 -0
- data/lib/jsonapi/realizer/error/invalid_content_type_header.rb +2 -1
- data/lib/jsonapi/realizer/error/{missing_root_property.rb → missing_accept_type_header.rb} +1 -1
- data/lib/jsonapi/realizer/error.rb +2 -4
- data/lib/jsonapi/realizer/version.rb +1 -1
- metadata +4 -7
- data/lib/jsonapi/realizer/error/include_without_data_property.rb +0 -10
- data/lib/jsonapi/realizer/error/invalid_data_type_property.rb +0 -15
- data/lib/jsonapi/realizer/error/invalid_root_property.rb +0 -15
- data/lib/jsonapi/realizer/error/missing_data_type_property.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e27ef8d0f337effce9f019b09f62b91642614055c1c70f293d7416e09190e51d
|
4
|
+
data.tar.gz: 060e44903b5318e3ef0ad5fd0aecfdd0d38f953d1aff90599a913808b1f4012a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6756609ed159ad246cb0d6a66ece7f0015cf24d160d96f4748df22485c91997477d796a752bb6daff710ab039005cb716e34e5f6df88c5fe6f1dc159ab097c97
|
7
|
+
data.tar.gz: 803312b24ccc9d9830a04784dec06f7b421f50cde0be1fa6418ab42b8f87122bcdd7029f17091bd3611e0c72a312853aa7050460aa67754b87fc7b5d9b13ca2e
|
@@ -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
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JSONAPI
|
4
|
+
module Realizer
|
5
|
+
class Error
|
6
|
+
class InvalidAcceptTypeHeader < Error
|
7
|
+
attr_accessor(:key)
|
8
|
+
attr_accessor(:given)
|
9
|
+
attr_accessor(:wanted)
|
10
|
+
|
11
|
+
def message
|
12
|
+
"HTTP #{key} Header recieved is #{given}, but expected #{wanted}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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
|
@@ -5,12 +5,10 @@ module JSONAPI
|
|
5
5
|
class Error < StandardError
|
6
6
|
include(ActiveModel::Model)
|
7
7
|
|
8
|
+
require_relative("error/invalid_accept_type_header")
|
9
|
+
require_relative("error/missing_accept_type_header")
|
8
10
|
require_relative("error/invalid_content_type_header")
|
9
11
|
require_relative("error/missing_content_type_header")
|
10
|
-
require_relative("error/invalid_root_property")
|
11
|
-
require_relative("error/missing_root_property")
|
12
|
-
require_relative("error/missing_data_type_property")
|
13
|
-
require_relative("error/include_without_data_property")
|
14
12
|
require_relative("error/resource_attribute_not_found")
|
15
13
|
require_relative("error/resource_relationship_not_found")
|
16
14
|
end
|
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.
|
4
|
+
version: 6.2.0
|
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-09-
|
11
|
+
date: 2023-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -72,13 +72,10 @@ files:
|
|
72
72
|
- lib/jsonapi/realizer/context.rb
|
73
73
|
- lib/jsonapi/realizer/controller.rb
|
74
74
|
- lib/jsonapi/realizer/error.rb
|
75
|
-
- lib/jsonapi/realizer/error/
|
75
|
+
- lib/jsonapi/realizer/error/invalid_accept_type_header.rb
|
76
76
|
- lib/jsonapi/realizer/error/invalid_content_type_header.rb
|
77
|
-
- lib/jsonapi/realizer/error/
|
78
|
-
- lib/jsonapi/realizer/error/invalid_root_property.rb
|
77
|
+
- lib/jsonapi/realizer/error/missing_accept_type_header.rb
|
79
78
|
- lib/jsonapi/realizer/error/missing_content_type_header.rb
|
80
|
-
- lib/jsonapi/realizer/error/missing_data_type_property.rb
|
81
|
-
- lib/jsonapi/realizer/error/missing_root_property.rb
|
82
79
|
- lib/jsonapi/realizer/error/resource_attribute_not_found.rb
|
83
80
|
- lib/jsonapi/realizer/error/resource_relationship_not_found.rb
|
84
81
|
- lib/jsonapi/realizer/resource.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JSONAPI
|
4
|
-
module Realizer
|
5
|
-
class Error
|
6
|
-
class InvalidDataTypeProperty < Error
|
7
|
-
attr_accessor(:given)
|
8
|
-
|
9
|
-
def message
|
10
|
-
"root.data property was #{given}, which is not an Hash, Array, or nil"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|