ivt_mellon_reader 0.4.3 → 0.5.1

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: 7b4646953eddf04bdbcb2fa4913b16349d2320bc
4
- data.tar.gz: 2a8d17867474b0b5b30d905df65b07e8ede3d96a
3
+ metadata.gz: 0b65bb2b6f6a2969059374a87ffbf351e0d273b8
4
+ data.tar.gz: 497da5b7321d903674d96ce151e78174cb840c6d
5
5
  SHA512:
6
- metadata.gz: c658c8b0a9f751436434840b238d68e3cb3f219d53ff69a5aa87caf19e17b8eba2f2e7445441bf5d78b46b7028f6a3b9aec46b8f43f42871923cef59153b251f
7
- data.tar.gz: 28402a62a057bbedf19707f98caa7c812eee57a654a37ffbf0f192c3491a632edd8920716fdcf887af7cc670dc00cfb8798952f7a746cd9b2ef6aee1ef01f3a0
6
+ metadata.gz: adc22b90c21a0fc255c97c8398156df7b337e631920875d33ada7cb1a9c6998e244ccde9dfa348061f257c03149b7e6febc0bb347721aa4a28b8aa13be356d32
7
+ data.tar.gz: f379fa1c9b46e9fa23512432df429a90070adc56004c88e00353762209c6473c122a0c64557507e887b0d2666617e055dc7c6226181b94c4b870d0336db78992
@@ -2,6 +2,7 @@ require 'ox'
2
2
  require 'mellon_client'
3
3
  require 'mellon_client_address'
4
4
  require 'mellon_client_phone'
5
+ require 'mellon_client_account'
5
6
  require 'saxerator'
6
7
 
7
8
  module IvtMellonReader
@@ -12,16 +13,14 @@ module IvtMellonReader
12
13
  config.symbolize_keys!
13
14
  end
14
15
 
15
- raise "Arquivo não contém nenhum cliente. Favor verifique se o formato do arquivo está correto." if @parser.for_tag(:Titularidade).entries.empty?
16
+ @clients = @parser.for_tag(:Titularidade)
16
17
 
17
- @clients = [@parser.for_tag(:Titularidade)].map(&:entries)
18
+ raise "Arquivo não contém nenhum cliente. Favor verifique se o formato do arquivo está correto." if @clients.to_a.empty?
18
19
 
19
20
  @clients.each do |client|
20
- client.each do |c|
21
- @client = c
22
- block.call(MellonClient.new(id, name, identification_document, gender, emails, phones, addresses, occupation, profession, birth_date, type, nav_range))
23
- end
24
-
21
+ @client = client
22
+ block.call(MellonClient.new(id, name, identification_document, gender, emails, phones,
23
+ addresses, occupation, profession, birth_date, type, nav_range, accounts))
25
24
  end
26
25
  end
27
26
 
@@ -103,6 +102,16 @@ module IvtMellonReader
103
102
  addresses
104
103
  end
105
104
 
105
+ def accounts
106
+ [ @client[:Contas][:conta] ].flatten(1).map do |account|
107
+ MellonClientAccount.new(
108
+ @client[:Contas][:conta][:idConta],
109
+ @client[:Contas][:conta][:NomeCotista],
110
+ @client[:Contas][:conta][:nomeDistribuidor],
111
+ )
112
+ end
113
+ end
114
+
106
115
  def birth_date
107
116
  if @client[:Titular].has_key? :dataNascimento
108
117
  if !@client[:Titular][:dataNascimento].empty?
@@ -1,3 +1,3 @@
1
1
  module IvtMellonReader
2
- VERSION = "0.4.3"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -1,3 +1,3 @@
1
- class MellonClient < Struct.new(:id, :name, :identification_document, :gender, :emails, :phones, :addresses, :occupation, :profession, :birth_date, :type, :nav_range)
1
+ class MellonClient < Struct.new(:id, :name, :identification_document, :gender, :emails, :phones, :addresses, :occupation, :profession, :birth_date, :type, :nav_range, :accounts)
2
2
 
3
3
  end
@@ -0,0 +1,3 @@
1
+ class MellonClientAccount < Struct.new(:id, :name, :distributor_name)
2
+
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ivt_mellon_reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Pérez'
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-17 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,6 +159,7 @@ files:
159
159
  - lib/ivt_mellon_reader/transaction.rb
160
160
  - lib/ivt_mellon_reader/version.rb
161
161
  - lib/mellon_client.rb
162
+ - lib/mellon_client_account.rb
162
163
  - lib/mellon_client_address.rb
163
164
  - lib/mellon_client_phone.rb
164
165
  - lib/mellon_transaction.rb