jsonapi-realizer 6.2.0 → 6.2.2

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: e27ef8d0f337effce9f019b09f62b91642614055c1c70f293d7416e09190e51d
4
- data.tar.gz: 060e44903b5318e3ef0ad5fd0aecfdd0d38f953d1aff90599a913808b1f4012a
3
+ metadata.gz: 76035465cf3254f1210f6fb47c9fa56774d0a7564456722a1f5f2845399e303b
4
+ data.tar.gz: a2ca1648916cac59450a0d01fd9d801c65b466d4c4db86e930d74cd966fdc694
5
5
  SHA512:
6
- metadata.gz: 6756609ed159ad246cb0d6a66ece7f0015cf24d160d96f4748df22485c91997477d796a752bb6daff710ab039005cb716e34e5f6df88c5fe6f1dc159ab097c97
7
- data.tar.gz: 803312b24ccc9d9830a04784dec06f7b421f50cde0be1fa6418ab42b8f87122bcdd7029f17091bd3611e0c72a312853aa7050460aa67754b87fc7b5d9b13ca2e
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,8 +167,7 @@ module JSONAPI
167
167
  end
168
168
 
169
169
  def attributes
170
- return unless data.key?("attributes")
171
-
170
+ return {} unless data["attributes"].kind_of?(Hash)
172
171
  @attributes ||= data
173
172
  .fetch("attributes")
174
173
  .transform_keys(&:underscore)
@@ -176,8 +175,7 @@ module JSONAPI
176
175
  end
177
176
 
178
177
  def relationships
179
- return unless data.key?("relationships")
180
-
178
+ return {} unless data["relationships"].kind_of?(Hash)
181
179
  @relationships ||= data
182
180
  .fetch("relationships")
183
181
  .transform_keys(&:underscore)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module JSONAPI
4
4
  module Realizer
5
- VERSION = "6.2.0"
5
+ VERSION = "6.2.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-realizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-27 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport