graphiti 1.0.1 → 1.0.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: d6b771f83fe6a2e3814d9a679f9072d970508dfea5ee389fc7c5746952a80632
4
- data.tar.gz: '0882e1c3ea5cc1aa77a1a74297ea8ce233e550d8600f489591b0d5ab37185023'
3
+ metadata.gz: 77a0b8b5d8df9c67801e64943896e8ab1641626c7819548839f07ec498242fb7
4
+ data.tar.gz: 33c1ee5fe14d815a9d1bb4bf2763d468d613a22ac7f8417a827ddb19623d2de8
5
5
  SHA512:
6
- metadata.gz: 3e125b4bbc009c7c2ccd3a143f0854d483b85198e170d3ead7e2c83b13b571ef12b1edbebb1019b479e5e9b2719b55becfcced4ab535c37d1a8553a3b09d7611
7
- data.tar.gz: 529665120a6676316e40bc97cf62126d7caf82c2a5c2735917f19690212d6f6e5c95868237e2dedcd08895e8bf8dad10adbfcc205c3e0c025a2e9d7bdc7ea225
6
+ metadata.gz: a75fed69be79eba1cc5b892c55a6b452683164666fb96597e119b36100b7de98dd2671615ea6bba208e75e084697b03ec1b35850a8cefe431c5dd2edfe6a9c93
7
+ data.tar.gz: 169cb3b32f2ce23767e4a158da84d5b0b307ed3ee6c834b059237b59ca6b711b727c4449a6ed7fa8055a33e561bca0a258a007753a2c65359fa47b11cc20abee
data/CHANGELOG.md CHANGED
@@ -1,8 +1,15 @@
1
+ ## 1.0.2
2
+
3
+ Fixes:
4
+
5
+ - [#125](https://github.com/graphiti-api/graphiti/pull/125) Fix destroy
6
+ with validation errors (@mihaimuntenas)
7
+
1
8
  ## 1.0.1
2
9
 
3
- - [#2288](https://github.com/graphiti-api/graphiti/pull/127)
4
- Avoid Rails eager loading edge case with polymorphic resources
5
- (@richmolj)
10
+ Fixes:
11
+
12
+ - [#127](https://github.com/graphiti-api/graphiti/pull/127) Avoid Rails eager loading edge case with polymorphic resources (@richmolj)
6
13
 
7
14
  ### master (unreleased)
8
15
 
data/lib/graphiti/base.rb CHANGED
@@ -41,6 +41,8 @@ module Graphiti
41
41
  payload = normalized_params
42
42
  if payload[:data] && payload[:data][:type]
43
43
  Graphiti::Deserializer.new(payload)
44
+ else
45
+ Graphiti::Deserializer.new
44
46
  end
45
47
  end
46
48
  end
@@ -45,7 +45,7 @@
45
45
  #
46
46
  # { type: 'authors', method: :create, temp_id: 'abc123' }
47
47
  class Graphiti::Deserializer
48
- def initialize(payload)
48
+ def initialize(payload = {})
49
49
  @payload = payload
50
50
  @payload = @payload[:_jsonapi] if @payload.key?(:_jsonapi)
51
51
  end
@@ -56,7 +56,7 @@ class Graphiti::Deserializer
56
56
 
57
57
  # @return [Hash] the raw :data value of the payload
58
58
  def data
59
- @payload[:data]
59
+ @payload.fetch(:data, {})
60
60
  end
61
61
 
62
62
  # @return [String] the raw :id value of the payload
@@ -189,18 +189,10 @@ class Graphiti::Deserializer
189
189
  end
190
190
 
191
191
  def raw_attributes
192
- if data
193
- data[:attributes] || {}
194
- else
195
- {}
196
- end
192
+ data.fetch(:attributes, {})
197
193
  end
198
194
 
199
195
  def raw_relationships
200
- if data
201
- data[:relationships] || {}
202
- else
203
- {}
204
- end
196
+ data.fetch(:relationships, {})
205
197
  end
206
198
  end
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-17 00:00:00.000000000 Z
11
+ date: 2019-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable