simplify_api 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 95b08b3251b492d23b3f64d0f6e56cd618312258c00be8c83e92fe24ef542f13
4
- data.tar.gz: c04a7faccf8bfae775f34f812a00be6df65181d0184d799b037201ef1b359ccb
3
+ metadata.gz: dc96340838401375e4e1bff48344bfc3ee11ce5a21746f57c918c5a808d98b84
4
+ data.tar.gz: 6cc74ddd8af6b5edd9114deb98238a45f585436b9dc153d5e845711cacd417c5
5
5
  SHA512:
6
- metadata.gz: 519bc3185592d157ca70aada4b607e799e9012675c8198810060a123db45e64eea61515737d91d6903d956c57ad9be12bc8a515d602fd0066c6bf298e12d026f
7
- data.tar.gz: 543b43052c838f3c5df57718d9bdb2bd369513c533025f94ee936a0f5d09c64eb72c886e9eee4ef98b3310d56c94a774a0500dfa139229e3717503afbb787ab8
6
+ metadata.gz: 355bb9df51c2f475bed90e34a8e8003207c240c1fa6cf8756f90de8fbd91290ef4558bfebb4dd660f5a5cd9055e1f3ae729b27c9f7467cf0be4c8dddce910623
7
+ data.tar.gz: 000c15c38132878e7b8c953888444820776de06c97601143cb05e01cebdb7e3dfd87bb11f82840f61205a4d342b7293075b4a68f55b36b26718f816d3e6ca3f6
@@ -28,12 +28,15 @@ module SimplifyApi
28
28
  end
29
29
 
30
30
  def initialize(opts)
31
+ opts = {self.class.attributes.first[0] => opts} if opts.class == Array
31
32
  opts.each_pair do |k, v|
32
33
  case v
33
34
  when Hash
34
35
  v = self.class.attributes[k.to_sym][:type].new(v)
35
36
  when Array
36
- v.collect! { |i| self.class.attributes[k.to_sym][:params][:array_type].new(i) }
37
+ v.collect! do |i|
38
+ self.class.attributes[k.to_sym][:params][:array_type].new(i)
39
+ end
37
40
  end
38
41
  create_and_set_instance_variable("#{k}", v)
39
42
  end
@@ -50,8 +53,13 @@ module SimplifyApi
50
53
  k = /\@(.*)/.match(i.to_s)[1].to_sym
51
54
  v = instance_variable_get(i)
52
55
  if v.class == Array then
53
- h[k] = []
54
- v.each {|a| h[k] << (a.respond_to?(:to_h) ? a.to_h : a) }
56
+ r = []
57
+ v.each {|a| r << (a.respond_to?(:to_h) ? a.to_h : a) }
58
+ if self.class.attributes[k][:params][:invisible] then
59
+ h = r
60
+ else
61
+ h[k] = r
62
+ end
55
63
  else
56
64
  h[k] = v.respond_to?(:to_h) ? v.to_h : v
57
65
  end
@@ -1,3 +1,3 @@
1
1
  module SimplifyApi
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Garcia Couto