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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c55ea1f4ccd068045f3c56d2acc2bac64a280b25
4
- data.tar.gz: 77f6be226eea9535161ce14616c042f0f967d65b
3
+ metadata.gz: bfe5894d0cf5db142b03d0a20548038fa721dc86
4
+ data.tar.gz: 6421ce63c3f6acecf3c23a7194ed1eaec1fe466f
5
5
  SHA512:
6
- metadata.gz: 1a50a5884274b367d8211a088e53061c9312a27814cc475529c6bde3b7a2d7f1ec1f1769649758a0f8e150dc3fafe1f4ec474fed2b05bbb0df62f79ac8312622
7
- data.tar.gz: bb4073ba62463c9dfea69a5f204ddb334acc28a53920745fa65fcfc4848839147e1224b6660a684dc8f00ffeadba94c033a4ca07b05e201387787cead05156fc
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 => attributes
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
- attributes_to_save = self.attributes.reject { |k,v| k == 'lifecycle_state' || v.blank? }
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
@@ -1,3 +1,3 @@
1
1
  module NaranyaEcm
2
- VERSION = "0.0.51"
2
+ VERSION = "0.0.52"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naranya_ecm-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: 0.0.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla