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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 916d37b9e745362ffe32ecb2714d9a3189bdf42ff25b5003418b0322fd8f13c3
4
- data.tar.gz: 50802e7b49a6d5fb1cec608971081f8780068190a7c444ea1d34b4e212a5cc2b
3
+ metadata.gz: 76035465cf3254f1210f6fb47c9fa56774d0a7564456722a1f5f2845399e303b
4
+ data.tar.gz: a2ca1648916cac59450a0d01fd9d801c65b466d4c4db86e930d74cd966fdc694
5
5
  SHA512:
6
- metadata.gz: e3889bbacc408251a944c9950f3cb4dd7eae46e6f12c66b422c67bf33ce60dde0d45c95db318f492a16a12a9606b731167607a10b516cb74fe40fd25d4d14632
7
- data.tar.gz: 2e096623acc9d4cc1ba48bb5c0f1c6364253ccd1d81cfabe73832a8ecfaba21c8197d61a5d90627fd66a374d1255961dcdc7125ba691c6bbd78af7e6655bff4a
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 }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module JSONAPI
4
4
  module Realizer
5
- VERSION = "6.2.1"
5
+ VERSION = "6.2.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-realizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.1
4
+ version: 6.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene