rixml 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rixml.rb +20 -1
  3. data/rixml.gemspec +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db768cb2bf306f25477e1ab267bfbf4833018449
4
- data.tar.gz: 188bda789fe4b822116fc6d38b9e42ea0a5c3606
3
+ metadata.gz: 25f629105503be64d6300105901129fcb5255c85
4
+ data.tar.gz: 53141679e00fee5e8f7aa363e1d67958e4dddb8e
5
5
  SHA512:
6
- metadata.gz: 7269c45ffaa2b497b5f9b0610ca3664f2c3e2b968cc61056424937cd4061427aeadf46fbf52ad6ab2e4325fae9e4bf2ddf26cd855c2b60e4b6210eef3455b781
7
- data.tar.gz: a9808fa3c482eaa12bf36f227a18c0b036d9779f660ad4f2a5c3ca17fb1b212c517bfae535496869563d43d480bb21ba3b376fd3ee549968d798b9cd1b6ca87e
6
+ metadata.gz: d7e3ba7ae9511506b9fe3085faed86d7aadf6fc906c6bfc134595b38d88e63db5fdd1edf6680e19df48836aaeacd7bba764e1c68bc8e4b82a400fd9c9e43397c
7
+ data.tar.gz: 68da09018210d6f6b27613c8b15c3d9191603e6ae64700face8366f0868e0a61f9a08315086a05f70b444262d1de73a6f9f0cdcb455d2a2501eafd8962d81bff
@@ -106,9 +106,11 @@ class RIXML
106
106
  return length.to_i if length.respond_to?(:to_i)
107
107
  end
108
108
 
109
+ # rubocop:disable Metrics/MethodLength
109
110
  def parse_info_from_author(author)
110
111
  person = author&.dig('Person')
111
112
  {
113
+ primary: primary?(author.dig('primaryIndicator')),
112
114
  name: person['DisplayName'],
113
115
  first_name: person['GivenName'],
114
116
  middle_name: person['MiddleName'],
@@ -118,6 +120,11 @@ class RIXML
118
120
  contacts: parse_author_contacts(person['ContactInfo'])
119
121
  }
120
122
  end
123
+ # rubocop:enable Metrics/MethodLength
124
+
125
+ def primary?(primary_indicator)
126
+ primary_indicator == 'Yes'
127
+ end
121
128
 
122
129
  def parse_author_contacts(contacts)
123
130
  contacts = [contacts] unless contacts.is_a? Array
@@ -174,7 +181,8 @@ class RIXML
174
181
  securities = [securities].compact unless securities.is_a? Array
175
182
  securities.map do |security|
176
183
  info = { name: (company.dig('IssuerName') || {})['NameValue'], primary: company['primaryIndicator'] == 'Yes' }
177
- info.merge(parse_security_info(security))
184
+ info = info.merge(parse_security_info(security))
185
+ info.merge(securities: parse_securities(security)) # Keep retrocompatibility adding a new key 'securities'
178
186
  end
179
187
  end
180
188
 
@@ -185,4 +193,15 @@ class RIXML
185
193
  { security_id['idType'].underscore.to_sym => security_id['idValue'] }
186
194
  end&.reduce({}, :merge) || []
187
195
  end
196
+
197
+ def parse_securities(security)
198
+ security_ids = security.dig('SecurityID')
199
+ security_ids = [security_ids].compact unless security_ids.is_a? Array
200
+ security_ids&.map do |security_id|
201
+ {
202
+ primary: primary?(security.dig('primaryIndicator')),
203
+ security_id['idType'].underscore.to_sym => security_id['idValue']
204
+ }
205
+ end
206
+ end
188
207
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'rixml'
4
- s.version = '0.4.8'
5
- s.date = '2017-09-25'
4
+ s.version = '0.4.9'
5
+ s.date = '2017-09-29'
6
6
  s.summary = 'RIXML Parser'
7
7
  s.description = 'Parse RIXML files'
8
8
  s.homepage = 'https://github.com/AlphaExchange/rixml'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rixml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Correia Santos
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-25 00:00:00.000000000 Z
12
+ date: 2017-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler