naranya_ecm-sdk 0.0.51 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/naranya_ecm/rest/persistence.rb +17 -3
- data/lib/naranya_ecm-sdk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfe5894d0cf5db142b03d0a20548038fa721dc86
|
4
|
+
data.tar.gz: 6421ce63c3f6acecf3c23a7194ed1eaec1fe466f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10cc3f36754e215986dc6757d8d3e48456c1cdca0e9b06867c33f5952d29ad84da99bd9ce46e79dc06dc221b6251a542cc1d2e48a91d504826d0e7a41ee25b7e
|
7
|
+
data.tar.gz: 3331f2ddedc3f5844b2667c69abb18e4d7f3c556d1050c759548f7689fbfcb6b54ba3c389dd359df1625352124c23d17b0a512ed1a79f0c940625f3461d08e12
|
@@ -68,7 +68,7 @@ module NaranyaEcm::Rest
|
|
68
68
|
|
69
69
|
def touch
|
70
70
|
@is_touch = true
|
71
|
-
self.update
|
71
|
+
self.update({})
|
72
72
|
end
|
73
73
|
|
74
74
|
# Returns true if this object hasn't been saved yet -- that is, a resource
|
@@ -277,8 +277,18 @@ module NaranyaEcm::Rest
|
|
277
277
|
|
278
278
|
response = NContent::SDK::RESTClient.post create_path do |req|
|
279
279
|
req.headers[:content_type] = 'application/json'
|
280
|
+
|
281
|
+
# Obtener solo los cambios con respecto al objeto recién
|
282
|
+
# inicializado:
|
283
|
+
attributes_to_post = changes.inject({}) do |attr_hash, attribute_change|
|
284
|
+
attribute_name, attribute_change_values = attribute_change
|
285
|
+
previous_attribute_value, new_attribute_value = attribute_change_values
|
286
|
+
attr_hash[attribute_name] = new_attribute_value
|
287
|
+
attr_hash
|
288
|
+
end
|
289
|
+
|
280
290
|
req.body = ActiveSupport::JSON.encode(
|
281
|
-
self.class.name.demodulize.underscore =>
|
291
|
+
self.class.name.demodulize.underscore => attributes_to_post
|
282
292
|
)
|
283
293
|
end
|
284
294
|
|
@@ -301,7 +311,11 @@ module NaranyaEcm::Rest
|
|
301
311
|
attributes_to_save[key] = val.last
|
302
312
|
end
|
303
313
|
else
|
304
|
-
|
314
|
+
# Encontrar el primer atributo con valor que no sea ID o lifecycle_state:
|
315
|
+
key, val = self.attributes.detect do |k,v|
|
316
|
+
!%w(id lifecycle_state).include?(k) && v.present?
|
317
|
+
end
|
318
|
+
attributes_to_save = { key => val }
|
305
319
|
end
|
306
320
|
|
307
321
|
attributes_to_save.merge! off_band_changes
|