jsonapi_compliable 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonapi_compliable/adapters/active_record.rb +0 -4
- data/lib/jsonapi_compliable/base.rb +2 -0
- data/lib/jsonapi_compliable/deserializable.rb +1 -1
- data/lib/jsonapi_compliable/resource.rb +4 -3
- data/lib/jsonapi_compliable/scope.rb +1 -1
- data/lib/jsonapi_compliable/util/hash.rb +14 -0
- 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: 58d8e742552f8d3c559e5717fd4e282846e4d904
|
4
|
+
data.tar.gz: f297e2bf808e4a22596ac9fdc54e0350f6a5e132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42c2dff29d06844d41e3c1042065d33d627e41d4a84231e947d77ca416b63317c9dd5e97fa94da9327197c918c5675a53293257d4bbe53206ec7de35d98cf743
|
7
|
+
data.tar.gz: bd862e16092f6e89f6652fc1c0dd814f0f30095329678776c9eb3045336b164a87360467b7f53d92b4fc5142f1aee3475e4a8bd7bdc1547373ae1cfb62277116
|
@@ -112,7 +112,7 @@ module JsonapiCompliable
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def deserialize_jsonapi!
|
115
|
-
self.raw_params = self.params
|
115
|
+
self.raw_params = Util::Hash.deep_dup(self.params)
|
116
116
|
|
117
117
|
if defined?(::Rails) && (is_a?(ActionController::Base) || (defined?(ActionController::API) && is_a?(ActionController::API)))
|
118
118
|
hash = params.to_unsafe_h
|
@@ -31,7 +31,7 @@ module JsonapiCompliable
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.inherited(klass)
|
34
|
-
klass.config = self.config
|
34
|
+
klass.config = Util::Hash.deep_dup(self.config)
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.sideloading
|
@@ -112,11 +112,12 @@ module JsonapiCompliable
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def copy
|
115
|
-
self.class.new(@config
|
115
|
+
self.class.new(@config)
|
116
116
|
end
|
117
117
|
|
118
118
|
def initialize(config = nil)
|
119
|
-
config = config || self.class.config
|
119
|
+
config = config || self.class.config
|
120
|
+
config = Util::Hash.deep_dup(config)
|
120
121
|
set_config(config)
|
121
122
|
end
|
122
123
|
|
@@ -24,7 +24,7 @@ module JsonapiCompliable
|
|
24
24
|
else
|
25
25
|
resolved = @object
|
26
26
|
# TODO - configurable resolve function
|
27
|
-
resolved = @object.to_a if @object.is_a?(ActiveRecord::Relation)
|
27
|
+
resolved = @object.to_a if defined?(ActiveRecord) && @object.is_a?(ActiveRecord::Relation)
|
28
28
|
sideload(resolved, query_hash[:include]) if query_hash[:include]
|
29
29
|
resolved
|
30
30
|
end
|
@@ -9,6 +9,20 @@ module JsonapiCompliable
|
|
9
9
|
|
10
10
|
collection
|
11
11
|
end
|
12
|
+
|
13
|
+
def self.deep_dup(hash)
|
14
|
+
if hash.respond_to?(:deep_dup)
|
15
|
+
hash.deep_dup
|
16
|
+
else
|
17
|
+
{}.tap do |duped|
|
18
|
+
hash.each_pair do |key, value|
|
19
|
+
value = deep_dup(value) if value.is_a?(Hash)
|
20
|
+
value = value.dup if value && value.respond_to?(:dup) && ![Symbol, Fixnum].include?(value.class)
|
21
|
+
duped[key] = value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
12
26
|
end
|
13
27
|
end
|
14
28
|
end
|
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.5.
|
4
|
+
version: 0.5.2
|
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: 2017-02-
|
12
|
+
date: 2017-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jsonapi-serializable
|