easy-jsonapi 1.0.3 → 1.0.8
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/.github/workflows/codecov.yml +8 -10
- data/.github/workflows/publish.yml +3 -6
- data/.rspec_status +492 -487
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +8 -0
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +2 -2
- data/README.md +21 -15
- data/docs/UsingTheRequestObject.md +1 -1
- data/docs/UsingUserConfigurations.md +1 -1
- data/easy-jsonapi.gemspec +1 -1
- data/lib/easy/jsonapi/exceptions/headers_exceptions.rb +18 -16
- data/lib/easy/jsonapi/exceptions/query_params_exceptions.rb +1 -1
- data/lib/easy/jsonapi/exceptions/user_defined_exceptions.rb +6 -2
- data/lib/easy/jsonapi/middleware.rb +23 -25
- data/lib/easy/jsonapi/parser/json_parser.rb +1 -1
- data/lib/easy/jsonapi/request/query_param_collection.rb +9 -3
- metadata +4 -3
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.1
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.0.8 - 2020-05-04
|
4
|
+
|
5
|
+
- Updated dependencies to fix security vulnerability in rexml
|
6
|
+
|
7
|
+
## 1.0.7 - 2020-03-31
|
8
|
+
|
9
|
+
- Fixed bug in JSONAPI::Parser::JSONParser that would serialize hashes with symbol key values instead of string
|
10
|
+
|
11
|
+
## 1.0.6 - 2020-03-30
|
12
|
+
|
13
|
+
- Fixed bug in JSONAPI::Middleware that was not checking for environment variables properly
|
14
|
+
|
15
|
+
## 1.0.5 - 2020-03-30
|
16
|
+
|
17
|
+
- Fixed bug in JSONAPI::Exceptions::HeadersExceptions that didn't check for user required headers requirements
|
18
|
+
- Fixed bug in JSONAPI::Exceptions::QueryParamExceptions that didn't check for user required query param requirements
|
19
|
+
- Added more tests to the middleware
|
20
|
+
- Updated Documentation
|
21
|
+
|
22
|
+
## 1.0.4 - 2020-03-28
|
23
|
+
|
24
|
+
- Fixed JSONAPI::ExceptionsHeadersExceptions bug
|
25
|
+
- Updated README files
|
26
|
+
|
3
27
|
## 1.0.3 - 2020-03-25
|
4
28
|
|
5
29
|
- Updated JSONAPI::Exceptions::HeadersExceptions to allow wildcard matching for Accept header
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
easy-jsonapi (1.0.
|
4
|
+
easy-jsonapi (1.0.8)
|
5
5
|
oj (~> 3.10)
|
6
6
|
|
7
7
|
GEM
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
racc (~> 1.4)
|
25
25
|
nokogiri (1.11.2-x86_64-linux)
|
26
26
|
racc (~> 1.4)
|
27
|
-
oj (3.11.
|
27
|
+
oj (3.11.5)
|
28
28
|
parallel (1.20.1)
|
29
29
|
parser (3.0.0.0)
|
30
30
|
ast (~> 2.4.1)
|
data/README.md
CHANGED
@@ -5,11 +5,13 @@
|
|
5
5
|
|
6
6
|
# easy-jsonapi
|
7
7
|
|
8
|
-
|
9
|
-

|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+

|
9
|
+

|
10
|
+

|
11
|
+

|
12
|
+

|
13
|
+

|
14
|
+
|
13
15
|
|
14
16
|
The gem that makes using [JSON:API](https://jsonapi.org/) ***EASY***!
|
15
17
|
|
@@ -19,9 +21,9 @@ Ever wanted the benefits of [JSONAPI](https://jsonapi.org/) without the learning
|
|
19
21
|
2. A `parser` to interact with requests in a typical Object-Oriented Fashion, providing convenient and efficient access to headers, query parameters, and document members.
|
20
22
|
3. A `validator` to check your serialized responses for [JSONAPI](https://jsonapi.org/) compliance.
|
21
23
|
|
22
|
-
With its only gem dependency being [Oj](https://github.com/ohler55/oj), ***easy-jsonapi*** is a lightweight, dependable tool, featuring comprehensive error messages and over
|
24
|
+
With its only gem dependency being [Oj](https://github.com/ohler55/oj), ***easy-jsonapi*** is a lightweight, dependable tool, featuring comprehensive error messages and over ***525 unit tests*** allowing developers to spend less time debugging and more time creating.
|
23
25
|
|
24
|
-
As a bonus, flexible user configurations can be added to the middleware providing custom screening on all requests or individual requests depending on the resource type of the endpoint and the
|
26
|
+
As a bonus, flexible user configurations can be added to the middleware providing custom screening on all requests or individual requests depending on the resource type of the endpoint and the user-defined document, header, or query param restrictions.
|
25
27
|
|
26
28
|
## Links
|
27
29
|
|
@@ -29,6 +31,8 @@ As a bonus, flexible user configurations can be added to the middleware providin
|
|
29
31
|
|
30
32
|
- [*RubyGems* *Repository*](https://rubygems.org/search?query=easy-jsonapi)
|
31
33
|
|
34
|
+
- [*Class Diagram*](https://lucid.app/lucidchart/invitations/accept/3d543b29-4171-43cb-94db-9aeb346cdcac)
|
35
|
+
|
32
36
|
## Installation
|
33
37
|
|
34
38
|
Add this line to your applications' Gemfile:
|
@@ -54,13 +58,15 @@ $ gem install easy-jsonapi
|
|
54
58
|
|
55
59
|
## Quick Start
|
56
60
|
|
57
|
-
|
61
|
+
***easy-jsonapi's*** 3 main use cases can be used together or separately, so to get started quickly, do any of the 3 below to begin enjoying the convenience of the library.
|
62
|
+
|
63
|
+
- Set up the middleware
|
58
64
|
|
59
65
|
```ruby
|
60
66
|
use JSONAPI::Middleware
|
61
67
|
```
|
62
68
|
|
63
|
-
|
69
|
+
- Parse the rack environment variable and get access to request components (assumes valid JSON:API requests -- use with middleware to ensure valid requests)
|
64
70
|
|
65
71
|
```ruby
|
66
72
|
j_req = JSONAPI::Parser.parse_request(env)
|
@@ -70,7 +76,7 @@ $ gem install easy-jsonapi
|
|
70
76
|
j_req.body.data.type # => "person"
|
71
77
|
```
|
72
78
|
|
73
|
-
|
79
|
+
- Validate your serialized JSON:API before returning it to your clients.
|
74
80
|
|
75
81
|
```ruby
|
76
82
|
begin
|
@@ -120,9 +126,9 @@ use JSONAPI::Middleware
|
|
120
126
|
|
121
127
|
### Functionality
|
122
128
|
|
123
|
-
The easy-jsonapi middleware can
|
129
|
+
The easy-jsonapi middleware can operate in development or production mode.
|
124
130
|
|
125
|
-
If `ENV['RACK_ENV']` is set to
|
131
|
+
If `ENV['RACK_ENV']` is set to `'development'` or not set at all, the middleware will be operating in development mode.
|
126
132
|
|
127
133
|
When the middleware is in development mode it will raise an exception wherever it finds the http request to be non JSONAPI compliant.
|
128
134
|
|
@@ -133,11 +139,11 @@ The types of exceptions it will raise are:
|
|
133
139
|
- `JSONAPI::Exceptions::QueryParamExceptions::InvalidQueryParam` when an included query parameter is non-compliant
|
134
140
|
- `JSONAPI::Exceptions::DocumentExceptions::InvalidDocument` when the body is included and non-compliant
|
135
141
|
|
136
|
-
If `ENV['RACK_ENV']` is set to something other than
|
142
|
+
If `ENV['RACK_ENV']` is set to something other than `'development'`, then the middleware will return the appropriate status code error given the JSON:API clause the headers, query params, or document violates.
|
137
143
|
|
138
144
|
### User Configurations
|
139
145
|
|
140
|
-
***easy-jsonapi*** has a fair amount of flexibility when it comes to user configurations
|
146
|
+
***easy-jsonapi*** has a fair amount of flexibility when it comes to user configurations but also plenty of room for to add more features. To see the currently available configurations see [UsingUserConfigurations](https://github.com/Curatess/easy-jsonapi/blob/production/docs/UsingUserConfigurations.md) and to propose a new feature create a pull request or ticket on the [dev repository](https://github.com/Curatess/easy-jsonapi/tree/dev).
|
141
147
|
|
142
148
|
## Using the Request Parser
|
143
149
|
|
@@ -196,7 +202,7 @@ See the [rubydocs](https://rubydoc.info/github/Curatess/easy-jsonapi/proudction)
|
|
196
202
|
|
197
203
|
## Acknowledgements
|
198
204
|
|
199
|
-
The exception checking strategy for `JSONAPI::Exceptions::DocumentExceptions` and some
|
205
|
+
The exception checking strategy for `JSONAPI::Exceptions::DocumentExceptions` and some initial compliance checks are based off [jsonapi-parser](https://github.com/jsonapi-rb/jsonapi-parser). We would like to thank the [jsonapi-rb](https://github.com/jsonapi-rb) team for the document validation work and to all our contributors and users for the continuous support!
|
200
206
|
|
201
207
|
## Releases
|
202
208
|
|
@@ -69,6 +69,6 @@ j_req.body.jsonapi # The JSONAPI jsonapi member
|
|
69
69
|
j_req.body.to_s # serialized JSONAPI
|
70
70
|
j_req.body.to_h # ruby hash representation of JSONAPI
|
71
71
|
|
72
|
-
# NOTE: j_req.body.data returns a
|
72
|
+
# NOTE: j_req.body.data returns a resource or an array of resources depending on the request
|
73
73
|
j_req.body.data # JSONAPI::Document::Resource or [JSONAPI::Document::Resource]
|
74
74
|
```
|
@@ -17,7 +17,7 @@ use JSONAPI::Middleware do |config_manager|
|
|
17
17
|
end
|
18
18
|
```
|
19
19
|
|
20
|
-
To add restrictions to ALL requests use default global config included with the Config Manager:
|
20
|
+
To add restrictions to ALL requests use the default global config included with the Config Manager:
|
21
21
|
|
22
22
|
```ruby
|
23
23
|
use JSONAPI::Middleware do |config_manager|
|
data/easy-jsonapi.gemspec
CHANGED
@@ -25,9 +25,11 @@ module JSONAPI
|
|
25
25
|
|
26
26
|
# Check http verb vs included headers
|
27
27
|
# @param env [Hash] The rack environment variable
|
28
|
+
# @param config_manager [JSONAPI::ConfigManager] The manager of user configurations
|
29
|
+
# @param opts [Hash] Includes http_method, path, and contains_body values
|
28
30
|
def self.check_request(env, config_manager = nil, opts = {})
|
29
31
|
check_compliance(env, config_manager, opts)
|
30
|
-
check_http_method_against_headers(env)
|
32
|
+
check_http_method_against_headers(env, opts[:contains_body])
|
31
33
|
end
|
32
34
|
|
33
35
|
# Check jsonapi compliance
|
@@ -39,7 +41,7 @@ module JSONAPI
|
|
39
41
|
hdrs = JSONAPI::Parser::HeadersParser.parse(env)
|
40
42
|
usr_opts = { http_method: opts[:http_method], path: opts[:path] }
|
41
43
|
err_msg = JSONAPI::Exceptions::UserDefinedExceptions.check_user_header_requirements(hdrs, config_manager, usr_opts)
|
42
|
-
|
44
|
+
raise err_msg unless err_msg.nil?
|
43
45
|
end
|
44
46
|
|
45
47
|
class << self
|
@@ -78,30 +80,30 @@ module JSONAPI
|
|
78
80
|
# error if the combination doesn't make sense
|
79
81
|
# @param (see #compliant?)
|
80
82
|
# @raise InvalidHeader the invalid header incombination with the http verb
|
81
|
-
def check_http_method_against_headers(env)
|
83
|
+
def check_http_method_against_headers(env, contains_body)
|
82
84
|
case env['REQUEST_METHOD']
|
83
85
|
when 'GET'
|
84
|
-
check_get_against_hdrs(env)
|
86
|
+
check_get_against_hdrs(env, contains_body)
|
85
87
|
when 'POST' || 'PATCH' || 'PUT'
|
86
|
-
check_post_against_hdrs(env)
|
88
|
+
check_post_against_hdrs(env, contains_body)
|
87
89
|
when 'DELETE'
|
88
|
-
check_delete_against_hdrs(env)
|
90
|
+
check_delete_against_hdrs(env, contains_body)
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
92
94
|
# Raise error if a GET request has a body or a content type header
|
93
95
|
# @param (see #compliant?)
|
94
|
-
def check_get_against_hdrs(env)
|
95
|
-
raise_error('GET requests cannot have a body.')
|
96
|
+
def check_get_against_hdrs(env, contains_body)
|
97
|
+
raise_error('GET requests cannot have a body.') if contains_body
|
96
98
|
raise_error("GET request cannot have a 'CONTENT_TYPE' http header.") unless env['CONTENT_TYPE'].nil?
|
97
99
|
end
|
98
100
|
|
99
101
|
# POST, PUT, and PATCH request must have a content type header,
|
100
102
|
# a body, and a content-type and accept header that accepts jsonapi
|
101
103
|
# @param (see #compliant?)
|
102
|
-
def check_post_against_hdrs(env)
|
104
|
+
def check_post_against_hdrs(env, contains_body)
|
103
105
|
raise_error("POST, PUT, and PATCH requests must have a 'CONTENT_TYPE' header.") unless env['CONTENT_TYPE']
|
104
|
-
raise_error('POST, PUT, and PATCH requests must have a body.') unless
|
106
|
+
raise_error('POST, PUT, and PATCH requests must have a body.') unless contains_body
|
105
107
|
|
106
108
|
return if env['CONTENT_TYPE'] == 'application/vnd.api+json' && accepts_jsonapi?(env)
|
107
109
|
|
@@ -109,6 +111,12 @@ module JSONAPI
|
|
109
111
|
"JSON:API media type, if they include a JSON:API 'CONTENT_TYPE' header")
|
110
112
|
end
|
111
113
|
|
114
|
+
# Raise error if DELETE hdr has a body or a content type header
|
115
|
+
def check_delete_against_hdrs(env, contains_body)
|
116
|
+
raise_error('DELETE requests cannot have a body.') if contains_body
|
117
|
+
raise_error("DELETE request cannot have a 'CONTENT_TYPE' http header.") unless env['CONTENT_TYPE'].nil?
|
118
|
+
end
|
119
|
+
|
112
120
|
# Check the accept header to see if any of the provided media types indicate that
|
113
121
|
# jsonapi is accepted
|
114
122
|
# @param (see #compliant?)
|
@@ -121,12 +129,6 @@ module JSONAPI
|
|
121
129
|
false
|
122
130
|
end
|
123
131
|
|
124
|
-
# Raise error if DELETE hdr has a body or a content type header
|
125
|
-
def check_delete_against_hdrs(env)
|
126
|
-
raise_error('DELETE requests cannot have a body.') unless env['rack.input'].nil?
|
127
|
-
raise_error("DELETE request cannot have a 'CONTENT_TYPE' http header.") unless env['CONTENT_TYPE'].nil?
|
128
|
-
end
|
129
|
-
|
130
132
|
# @param accept_hdr [String] The value of the http accept header
|
131
133
|
def contains_at_least_one_jsonapi_media_type_without_params?(accept_hdr)
|
132
134
|
accept_hdr.split(',').each do |mt|
|
@@ -62,8 +62,10 @@ module JSONAPI
|
|
62
62
|
# with underscores instead of dashes.
|
63
63
|
# @param config (see #check_user_document_requirements)
|
64
64
|
def check_user_header_requirements(headers, config_manager, opts)
|
65
|
-
return if config_manager.nil?
|
65
|
+
return if config_manager.nil?
|
66
|
+
|
66
67
|
config = get_config(config_manager, opts[:http_method], opts[:path])
|
68
|
+
return if config.default? && config_manager.size.positive?
|
67
69
|
|
68
70
|
err =
|
69
71
|
check_for_required_headers(headers, config.required_headers)
|
@@ -77,8 +79,10 @@ module JSONAPI
|
|
77
79
|
# @param rack_req_params [Hash] The hash of the query parameters given by Rack::Request
|
78
80
|
# @param config (see #check_user_document_requirements)
|
79
81
|
def check_user_query_param_requirements(rack_req_params, config_manager, opts)
|
80
|
-
return if config_manager.nil?
|
82
|
+
return if config_manager.nil?
|
83
|
+
|
81
84
|
config = get_config(config_manager, opts[:http_method], opts[:path])
|
85
|
+
return if config.default? && config_manager.size.positive?
|
82
86
|
|
83
87
|
err =
|
84
88
|
check_for_required_params(rack_req_params, config.required_query_params)
|
@@ -23,8 +23,8 @@ module JSONAPI
|
|
23
23
|
# and error if any section is found to be non-compliant.
|
24
24
|
# @param env The rack envirornment hash
|
25
25
|
def call(env)
|
26
|
-
if in_maintenance_mode?
|
27
|
-
return maintenance_response
|
26
|
+
if in_maintenance_mode?
|
27
|
+
return maintenance_response
|
28
28
|
end
|
29
29
|
|
30
30
|
if jsonapi_request?(env)
|
@@ -38,17 +38,15 @@ module JSONAPI
|
|
38
38
|
private
|
39
39
|
|
40
40
|
# Checks the 'MAINTENANCE' environment variable
|
41
|
-
# @param (see #call)
|
42
41
|
# @return [TrueClass | FalseClass]
|
43
|
-
def in_maintenance_mode?
|
44
|
-
!
|
42
|
+
def in_maintenance_mode?
|
43
|
+
!ENV['MAINTENANCE'].nil?
|
45
44
|
end
|
46
45
|
|
47
46
|
# Return 503 with or without msg depending on environment
|
48
|
-
# @param (see #call)
|
49
47
|
# @return [Array] Http Error Responses
|
50
|
-
def maintenance_response
|
51
|
-
if environment_development?
|
48
|
+
def maintenance_response
|
49
|
+
if environment_development?
|
52
50
|
[503, {}, ['MAINTENANCE envirornment variable set']]
|
53
51
|
else
|
54
52
|
[503, {}, []]
|
@@ -88,18 +86,21 @@ module JSONAPI
|
|
88
86
|
# @param config_manager [JSONAPI::ConfigManager::Config] The config object to use modify compliance checking
|
89
87
|
# @return [NilClass | Array] Nil meaning no error or a 400 level http response
|
90
88
|
def check_compliance(env, config_manager)
|
91
|
-
|
89
|
+
# Store separately so you can rewind for next middleware or app
|
90
|
+
body = env['rack.input'].read
|
91
|
+
env['rack.input'].rewind
|
92
|
+
opts = { http_method: env['REQUEST_METHOD'], path: env['PATH_INFO'], contains_body: body != "" }
|
92
93
|
|
93
94
|
header_error = check_headers_compliance(env, config_manager, opts)
|
94
95
|
return header_error unless header_error.nil?
|
95
96
|
|
96
97
|
req = Rack::Request.new(env)
|
97
|
-
param_error = check_query_param_compliance(
|
98
|
+
param_error = check_query_param_compliance(req.GET, config_manager, opts)
|
98
99
|
return param_error unless param_error.nil?
|
99
100
|
|
100
101
|
return unless env['CONTENT_TYPE']
|
101
102
|
|
102
|
-
body_error =
|
103
|
+
body_error = check_body_compliance(body, config_manager, opts)
|
103
104
|
return body_error unless body_error.nil?
|
104
105
|
end
|
105
106
|
|
@@ -108,8 +109,8 @@ module JSONAPI
|
|
108
109
|
# @return [NilClass | Array] Nil meaning no error or a 400 level http response
|
109
110
|
def check_headers_compliance(env, config_manager, opts)
|
110
111
|
JSONAPI::Exceptions::HeadersExceptions.check_request(env, config_manager, opts)
|
111
|
-
rescue JSONAPI::Exceptions::HeadersExceptions::InvalidHeader
|
112
|
-
raise if environment_development?
|
112
|
+
rescue JSONAPI::Exceptions::HeadersExceptions::InvalidHeader, JSONAPI::Exceptions::UserDefinedExceptions::InvalidHeader => e
|
113
|
+
raise if environment_development?
|
113
114
|
|
114
115
|
[e.status_code, {}, []]
|
115
116
|
end
|
@@ -117,10 +118,10 @@ module JSONAPI
|
|
117
118
|
# @param query_params [Hash] The rack request query_param hash
|
118
119
|
# @raise If the query parameters are not JSONAPI compliant
|
119
120
|
# @return [NilClass | Array] Nil meaning no error or a 400 level http response
|
120
|
-
def check_query_param_compliance(
|
121
|
+
def check_query_param_compliance(query_params, config_manager, opts)
|
121
122
|
JSONAPI::Exceptions::QueryParamsExceptions.check_compliance(query_params, config_manager, opts)
|
122
|
-
rescue JSONAPI::Exceptions::QueryParamsExceptions::InvalidQueryParameter
|
123
|
-
raise if environment_development?
|
123
|
+
rescue JSONAPI::Exceptions::QueryParamsExceptions::InvalidQueryParameter, JSONAPI::Exceptions::UserDefinedExceptions::InvalidQueryParam => e
|
124
|
+
raise if environment_development?
|
124
125
|
|
125
126
|
[e.status_code, {}, []]
|
126
127
|
end
|
@@ -128,17 +129,14 @@ module JSONAPI
|
|
128
129
|
# @param env (see #call)
|
129
130
|
# @param req (see #check_query_param_compliance)
|
130
131
|
# @raise If the document body is not JSONAPI compliant
|
131
|
-
def
|
132
|
-
# Store separately so you can rewind for next middleware or app
|
133
|
-
body = env['rack.input'].read
|
134
|
-
env['rack.input'].rewind
|
132
|
+
def check_body_compliance(body, config_manager, opts)
|
135
133
|
JSONAPI::Exceptions::DocumentExceptions.check_compliance(body, config_manager, opts)
|
136
|
-
rescue JSONAPI::Exceptions::DocumentExceptions::InvalidDocument
|
137
|
-
raise if environment_development?
|
134
|
+
rescue JSONAPI::Exceptions::DocumentExceptions::InvalidDocument, JSONAPI::Exceptions::UserDefinedExceptions::InvalidDocument => e
|
135
|
+
raise if environment_development?
|
138
136
|
|
139
137
|
[e.status_code, {}, []]
|
140
138
|
rescue JSONAPI::Exceptions::JSONParseError
|
141
|
-
raise if environment_development?
|
139
|
+
raise if environment_development?
|
142
140
|
|
143
141
|
[400, {}, []]
|
144
142
|
end
|
@@ -151,8 +149,8 @@ module JSONAPI
|
|
151
149
|
end
|
152
150
|
|
153
151
|
# @param (see #call)
|
154
|
-
def environment_development?
|
155
|
-
|
152
|
+
def environment_development?
|
153
|
+
ENV['RACK_ENV'].to_s.downcase == 'development' || ENV['RACK_ENV'].nil?
|
156
154
|
end
|
157
155
|
end
|
158
156
|
end
|
@@ -8,10 +8,12 @@ module JSONAPI
|
|
8
8
|
# A collection of QueryParam objects
|
9
9
|
class QueryParamCollection < JSONAPI::NameValuePairCollection
|
10
10
|
|
11
|
+
# The special query params defined by the JSON:API specification
|
12
|
+
SPECIAL_QUERY_PARAMS = %i[sorts filters fields page includes].freeze
|
13
|
+
|
11
14
|
# @param param_arr [Array<JSONAPI::Request::QueryParamCollection::QueryParam] The
|
12
15
|
# query params to initialize the collection with
|
13
16
|
def initialize(param_arr = [])
|
14
|
-
@param_names = []
|
15
17
|
super(param_arr, item_type: JSONAPI::Request::QueryParamCollection::QueryParam)
|
16
18
|
end
|
17
19
|
|
@@ -43,8 +45,12 @@ module JSONAPI
|
|
43
45
|
# @param args If any arguments were passed to the method called
|
44
46
|
# @param block If a block was passed to the method called
|
45
47
|
def method_missing(method_name, *args, &block)
|
46
|
-
|
47
|
-
|
48
|
+
included = include?(method_name)
|
49
|
+
super unless included || SPECIAL_QUERY_PARAMS.include?(method_name)
|
50
|
+
if included
|
51
|
+
return get(method_name)
|
52
|
+
end
|
53
|
+
nil
|
48
54
|
end
|
49
55
|
|
50
56
|
# Whether or not method missing should be called.
|