naranya_ecm-sdk 0.0.28 → 0.0.29

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
  SHA1:
3
- metadata.gz: fe024c1fb8de7856dc1c7fc5890f5194046059b8
4
- data.tar.gz: eae615e6dc5b250134ac204e936a7509b019f4d1
3
+ metadata.gz: 43a17f984bc77a91ab6f48708316247507c6998d
4
+ data.tar.gz: 938b9aa5bc94cb567bd40df4df89491068f831cd
5
5
  SHA512:
6
- metadata.gz: 6e1ed60fa76e8b03a7f20e2a4c7995b16e147d234ca671c93319ae62ccfa740920238f7baa17f387fbfcac35b9be253b44d34ed772b912013d69e9bee3b2d177
7
- data.tar.gz: dcf357e123ab07edd39cc5adf3df13ffbb36416d2bc45076e83593775781ec7bffd1182ffcd64d3103a4c45d50aad6ea6abbbe952397dd35fdc171fed8c4748e
6
+ metadata.gz: 04148763fe680ec57f5927a6407ada9c28fa1919ea1524c7120a20f72dbe6ef6f934e2c259e5c2add795249100c62c725e43b576d5f3a8a79a028c645bfe0225
7
+ data.tar.gz: ced5f82fd6da50e743e95f82c56d38a812022adaf2ac6699d47a6c35a00a15fd7dbd93ef82519edd9abcfaa5e7ea936939a7ede0bd71cdc3af67d7057e9c98ef
@@ -58,9 +58,7 @@ module NaranyaEcm::Rest
58
58
  reflection = self.class.reflect_on_association(name)
59
59
  relation = Relation.new(reflection.associated_class, { reflection.foreign_key => self.id })
60
60
 
61
- unless new_value.blank?
62
- relation.load new_value
63
- end
61
+ relation.load new_value unless new_value.nil?
64
62
 
65
63
  instance_variable_set "@#{name}".to_sym, relation
66
64
  end
@@ -21,7 +21,7 @@ module NaranyaEcm::Rest
21
21
  end
22
22
 
23
23
  def to_a
24
- materialize! unless @elements
24
+ materialize! if @elements.nil?
25
25
  elements
26
26
  end
27
27
 
@@ -32,9 +32,10 @@ module NaranyaEcm::Rest
32
32
 
33
33
  def load(given_list)
34
34
  # Revisar que todos los elementos sean Hash o la clase asociada:
35
- raise "Type Mismatch: some elements are not a hash nor associated_class" unless given_list
36
- .map { |e| e.is_a?(Hash) || e.is_a?(@klass) }
37
- .reduce { |res, e| res && e }
35
+ if given_list.count > 0 && given_list.map{ |e| e.is_a?(Hash) || e.is_a?(@klass) }.reduce { |res, e| res && e } == false
36
+ raise "Type Mismatch: some elements are not a hash nor associated_class"
37
+ end
38
+
38
39
  @elements = given_list.map { |e| e.is_a?(Hash) ? @klass.load(e) : e }
39
40
  end
40
41
 
@@ -1,3 +1,3 @@
1
1
  module NaranyaEcm
2
- VERSION = "0.0.28"
2
+ VERSION = "0.0.29"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naranya_ecm-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport