jsonapi-resources 0.9.11 → 0.9.12
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: bfb7891ac7686be582e0831afd808f08504e492998968e704de2086c1656e9af
|
4
|
+
data.tar.gz: edeb27a90bec0a6fc79f67e0311cdf7e588fdcf347426489c21d94bcd40a3f28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 645534a3b1811e939fb6e36098e7624072793b59a39eecc99b05743ff77e91289ca6b35441c614220833049b689f8bcf7b6b6fb9fb1f09190b239b706b3d2da7
|
7
|
+
data.tar.gz: 7b562179f5f6ab17179c71208838fccaa1703d6c88eb99356075daa255a57242f59972e5ba0118740d4d80f7bc5706f2f87b4e99b0840cca32d00b19056f5712
|
data/lib/jsonapi/link_builder.rb
CHANGED
@@ -29,7 +29,7 @@ module JSONAPI
|
|
29
29
|
def primary_resources_url
|
30
30
|
if @primary_resource_klass._routed
|
31
31
|
primary_resources_path = resources_path(primary_resource_klass)
|
32
|
-
@primary_resources_url_cached ||= "#{ base_url }#{
|
32
|
+
@primary_resources_url_cached ||= "#{ base_url }#{ serialized_engine_mount_point }#{ primary_resources_path }"
|
33
33
|
else
|
34
34
|
if JSONAPI.configuration.warn_on_missing_routes && !@primary_resource_klass._warned_missing_route
|
35
35
|
warn "primary_resources_url for #{@primary_resource_klass} could not be generated"
|
@@ -139,7 +139,11 @@ module JSONAPI
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def resource_url(source)
|
142
|
-
"#{ base_url }#{
|
142
|
+
"#{ base_url }#{ serialized_engine_mount_point }#{ resource_path(source) }"
|
143
|
+
end
|
144
|
+
|
145
|
+
def serialized_engine_mount_point
|
146
|
+
engine_mount_point == "/" ? "" : engine_mount_point
|
143
147
|
end
|
144
148
|
|
145
149
|
def route_for_relationship(relationship)
|
data/lib/jsonapi/relationship.rb
CHANGED
@@ -55,8 +55,14 @@ module JSONAPI
|
|
55
55
|
|
56
56
|
def type_for_source(source)
|
57
57
|
if polymorphic?
|
58
|
-
resource
|
59
|
-
|
58
|
+
# try polymorphic type column before asking it from the resource record
|
59
|
+
if source._model.respond_to?(polymorphic_type)
|
60
|
+
model_type = source._model.send(polymorphic_type)
|
61
|
+
source.class.resource_for(model_type)._type if model_type
|
62
|
+
else
|
63
|
+
resource = source.public_send(name)
|
64
|
+
resource.class._type if resource
|
65
|
+
end
|
60
66
|
else
|
61
67
|
type
|
62
68
|
end
|
@@ -291,7 +291,7 @@ module JSONAPI
|
|
291
291
|
return @errors.concat(Exceptions::FilterNotAllowed.new(filter_method).errors)
|
292
292
|
end
|
293
293
|
|
294
|
-
verified_filter = relationship.resource_klass.verify_filters(filter_method => value)
|
294
|
+
verified_filter = relationship.resource_klass.verify_filters({ filter_method => value }, @context)
|
295
295
|
@include_directives.merge_filter(relationship.name, verified_filter)
|
296
296
|
else
|
297
297
|
return @errors.concat(Exceptions::FilterNotAllowed.new(filter_method).errors)
|
@@ -314,7 +314,7 @@ module JSONAPI
|
|
314
314
|
|
315
315
|
sorts = []
|
316
316
|
begin
|
317
|
-
raw = URI.unescape(sort_criteria)
|
317
|
+
raw = URI::DEFAULT_PARSER.unescape(sort_criteria)
|
318
318
|
sorts += CSV.parse_line(raw)
|
319
319
|
rescue CSV::MalformedCSVError
|
320
320
|
fail JSONAPI::Exceptions::InvalidSortCriteria.new(format_key(@resource_klass._type), raw)
|
@@ -5,10 +5,10 @@ module JSONAPI
|
|
5
5
|
ActionController::Rendering,
|
6
6
|
ActionController::Renderers::All,
|
7
7
|
ActionController::StrongParameters,
|
8
|
-
ActionController::ForceSSL,
|
8
|
+
Gem::Requirement.new('< 6.1').satisfied_by?(ActionPack.gem_version) ? ActionController::ForceSSL : nil,
|
9
9
|
ActionController::Instrumentation,
|
10
10
|
JSONAPI::ActsAsResourceController
|
11
|
-
].freeze
|
11
|
+
].compact.freeze
|
12
12
|
|
13
13
|
MODULES.each do |mod|
|
14
14
|
include mod
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Gebhardt
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|