jsonapi-realizer 6.2.1 → 6.2.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/realizer/action.rb +4 -2
- data/lib/jsonapi/realizer/resource.rb +4 -2
- data/lib/jsonapi/realizer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76035465cf3254f1210f6fb47c9fa56774d0a7564456722a1f5f2845399e303b
|
4
|
+
data.tar.gz: a2ca1648916cac59450a0d01fd9d801c65b466d4c4db86e930d74cd966fdc694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2a961ef650cf889f4637a19c9ed606867a9cf45bfabd267df96b846eb576d10ae060e8073f2606f24e4a812c9f67298e37e721c6e2644212b527f651e544aaf
|
7
|
+
data.tar.gz: 9766f382f722a9b18a982c33476940bf960966cb33189b4ddeb6a1c00b6cfdd853e967dbdd6677df673621fbcbe5c7d514904ae1c6bc7d995ea21bda4540dca5
|
@@ -123,18 +123,20 @@ module JSONAPI
|
|
123
123
|
|
124
124
|
private def attributes
|
125
125
|
return unless data
|
126
|
+
return {} unless data["attributes"].kind_of?(Hash)
|
126
127
|
|
127
128
|
data
|
128
|
-
.fetch("attributes"
|
129
|
+
.fetch("attributes")
|
129
130
|
.transform_keys(&:underscore)
|
130
131
|
.select(&resource_class.method(:valid_attribute?))
|
131
132
|
end
|
132
133
|
|
133
134
|
private def relationships
|
134
135
|
return unless data
|
136
|
+
return {} unless data["relationships"].kind_of?(Hash)
|
135
137
|
|
136
138
|
data
|
137
|
-
.fetch("relationships"
|
139
|
+
.fetch("relationships")
|
138
140
|
.transform_keys(&:underscore)
|
139
141
|
.select(&resource_class.method(:valid_relationship?))
|
140
142
|
.transform_values(&method(:as_relationship))
|
@@ -167,15 +167,17 @@ module JSONAPI
|
|
167
167
|
end
|
168
168
|
|
169
169
|
def attributes
|
170
|
+
return {} unless data["attributes"].kind_of?(Hash)
|
170
171
|
@attributes ||= data
|
171
|
-
.fetch("attributes"
|
172
|
+
.fetch("attributes")
|
172
173
|
.transform_keys(&:underscore)
|
173
174
|
.transform_keys { |key| attribute(key).as }
|
174
175
|
end
|
175
176
|
|
176
177
|
def relationships
|
178
|
+
return {} unless data["relationships"].kind_of?(Hash)
|
177
179
|
@relationships ||= data
|
178
|
-
.fetch("relationships"
|
180
|
+
.fetch("relationships")
|
179
181
|
.transform_keys(&:underscore)
|
180
182
|
.map(&method(:as_relationship)).to_h
|
181
183
|
.transform_keys { |key| relation(key).as }
|