jsonapi_errorable 0.9.2 → 0.9.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7b1aa4cf6cf046c0746862e1edb37737684235f
|
4
|
+
data.tar.gz: 5a25c14763b242c60384ff2e01ef81e14cf04550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 252c40d38617a13cb9a5a4f478e1088045fce3cfb86af83be1d4de07b195e9eade0a426e459153ac01b8c005cdc224d51b80fe7f419c429933f423822f50eaf5
|
7
|
+
data.tar.gz: 7c024a01848c980e7db19e0f2136565a3deea5ab3d3fc7cf1624353cc0e60680b3012a0108ab42dde687d8a58ef82c3ef54978c9fe5aa60af2560fc4e6a23307
|
@@ -30,7 +30,7 @@ module JsonapiErrorable
|
|
30
30
|
return [] unless object.respond_to?(:errors)
|
31
31
|
|
32
32
|
all_errors = attribute_errors
|
33
|
-
all_errors |= relationship_errors(@relationship_payloads)
|
33
|
+
all_errors |= relationship_errors(object, @relationship_payloads)
|
34
34
|
all_errors
|
35
35
|
end
|
36
36
|
|
@@ -105,11 +105,11 @@ module JsonapiErrorable
|
|
105
105
|
object.class.respond_to?(:reflect_on_all_associations)
|
106
106
|
end
|
107
107
|
|
108
|
-
def traverse_relationships(relationship_params)
|
108
|
+
def traverse_relationships(model, relationship_params)
|
109
109
|
return unless relationship_params
|
110
110
|
|
111
111
|
relationship_params.each_pair do |name, payload|
|
112
|
-
relationship_objects = Array(
|
112
|
+
relationship_objects = Array(model.send(name))
|
113
113
|
|
114
114
|
relationship_objects.each do |relationship_object|
|
115
115
|
related_payload = payload
|
@@ -123,14 +123,14 @@ module JsonapiErrorable
|
|
123
123
|
end
|
124
124
|
|
125
125
|
yield name, relationship_object, related_payload
|
126
|
-
relationship_errors(related_payload[:relationships])
|
126
|
+
relationship_errors(relationship_object, related_payload[:relationships])
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
def relationship_errors(relationship_payloads)
|
131
|
+
def relationship_errors(model, relationship_payloads)
|
132
132
|
errors = []
|
133
|
-
traverse_relationships(relationship_payloads) do |name, model, payload|
|
133
|
+
traverse_relationships(model, relationship_payloads) do |name, model, payload|
|
134
134
|
meta = {}.tap do |hash|
|
135
135
|
hash[:name] = name
|
136
136
|
hash[:type] = payload[:meta][:jsonapi_type]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_errorable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.6.
|
146
|
+
rubygems_version: 2.6.13
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: jsonapi.org compatible error handling
|