deep_unrest 0.1.37 → 0.1.38

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: 81050e835a80fcd169a4bcfe4213d2378575ac6a87942bf07289e1b4b8c6722b
4
- data.tar.gz: bdbbc8aa16a157a2103beb572173ea0018a251936dbe132a7e33adcb677afc77
3
+ metadata.gz: e974c31d347306f0d22490ba09b44150485d9b2015078c4039bfd4b40c4c9ff7
4
+ data.tar.gz: 54ddf41fab967a1341433f98b53b02f6abd3e984228393b94c74cebe11595834
5
5
  SHA512:
6
- metadata.gz: e02bc06a96e1bc77f6a28be4d334e847c66cce02fbe8cdc7312191f94467d8889abd734716b085c56ab9fc1ab91ecd1a0c58d3794d37fd15948407813521fb14
7
- data.tar.gz: c85e21c88985ad241d8c571926357f1ada73a8dee802bdca4c4abebdedf8fe2a3e5469b9681623f171d40489d5b4e8a7aac7fd34141a04626e075143af9ce8db
6
+ metadata.gz: c67919a65447a3e7daeb49f320ba29c93e2b0f10375f327cb8a1e08ca2f7ce5f8f7722267ca1544b8ff76153b6acdce99b79597b4313b637fd27347d2fb8e5f3
7
+ data.tar.gz: de24c2023e94e72e8e6969f6f0fb37cbbc45ff263fefc668cba14171db4d91a44a625879b558880a8ee930e09c47331272ffa08accb4bf8132e98496155a6120
@@ -67,6 +67,8 @@ module DeepUnrest
67
67
  render json: err.message, status: :conflict
68
68
  ensure
69
69
  @@temp_ids.delete(request.uuid)
70
+ @@destroyed_entities.clear
71
+ @@changed_entities.clear
70
72
  end
71
73
 
72
74
  def update
data/lib/deep_unrest.rb CHANGED
@@ -115,8 +115,10 @@ module DeepUnrest
115
115
 
116
116
  def self.validate_association(parent, type)
117
117
  return unless parent
118
+
118
119
  reflection = parent[:klass].reflect_on_association(to_assoc(type))
119
120
  raise NoMethodError unless reflection.klass == to_class(type)
121
+
120
122
  unless parent[:id]
121
123
  raise InvalidParentScope, 'Unable to update associations of collections '\
122
124
  "('#{parent[:type]}.#{type}')."
@@ -147,6 +149,7 @@ module DeepUnrest
147
149
  unless result.map { |res| res.join('') }.join('.') == path
148
150
  raise InvalidPath, "Invalid path: #{path}"
149
151
  end
152
+
150
153
  result
151
154
  end
152
155
 
@@ -215,6 +218,7 @@ module DeepUnrest
215
218
  def self.parse_id(id_str)
216
219
  return false if id_str.nil?
217
220
  return id_str if id_str.is_a? Integer
221
+
218
222
  id_match = id_str.match(/^\.?(?<id>[\w\-]+)$/)
219
223
  id_match && id_match[:id]
220
224
  end
@@ -222,6 +226,7 @@ module DeepUnrest
222
226
  def self.increment_error_indices(path_info, memo)
223
227
  path_info.each_with_index.map do |(type, id), i|
224
228
  next if i.zero?
229
+
225
230
  parent_type, parent_id = path_info[i - 1]
226
231
  key = "#{parent_type}#{parent_id}#{type}"
227
232
  memo[key] = [] unless memo[key]
@@ -631,7 +636,7 @@ module DeepUnrest
631
636
  return {
632
637
  redirect_regex: build_redirect_regex(temp_id_map[uuid]),
633
638
  temp_ids: temp_id_map[uuid],
634
- destroyed: destroyed,
639
+ destroyed: destroyed.map { |d| d.except(:query_uuid) },
635
640
  changed: diff
636
641
  }
637
642
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepUnrest
4
- VERSION = '0.1.37'
4
+ VERSION = '0.1.38'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_unrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.37
4
+ version: 0.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley