rixml 0.2.2 → 0.3.0

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/rixml.rb +13 -6
  4. data/rixml.gemspec +2 -2
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8b52638daba788b8ba9d4bfbd4efcb103e1c2b0
4
- data.tar.gz: 0b7d73437957344e68d43b76c4a711dacebe0a46
3
+ metadata.gz: 0cfc433d3b60277f8fe8bb6a853bcd308dd4dc50
4
+ data.tar.gz: 40a4330fec5dd6c3ba30a80825d2a642cd1ec045
5
5
  SHA512:
6
- metadata.gz: c54d0a5e625c37b51bef18e8cf67c75c82d4d2236d226f4e8f568bcbd1258877803c9f9f575d5917eb807365574d901972f9d617c4ac97e01d82ebe58e8cd11b
7
- data.tar.gz: b57390439e4c64296f9ce47f3a260f37d5f420d598d97b308f62d30e4c0ed1a97f09104b8e595693b5e3c89667e79f3edbb8adeb943995778decb350138765d7
6
+ metadata.gz: dbc05133d46255f6503c8c76ffdb6909bfffcfe12d452b87b0ed74c5718ed7ce577a8704766691831f3c7f5e54adc26ecf8e15a53003ff6d435c5782afd9042e
7
+ data.tar.gz: 097921ef8bcfbbaa26755914daf85b76f1a482bfde4eeab2ddda2419744b4e5cead1885a1e293ab26d832e600853dadfcfaf3dbcd6082f2238379cb3838d3008
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rixml (0.2.2)
4
+ rixml (0.3.0)
5
5
  activesupport (>= 4.0.0)
6
6
  nokogiri (~> 1.5)
7
7
 
@@ -119,19 +119,26 @@ class RIXML
119
119
  companies = []
120
120
  [context['IssuerDetails']].flatten.compact.each do |issuer|
121
121
  [issuer['Issuer']].flatten.compact.select { |c| c['issuerType'] == 'Corporate' }.each do |company|
122
- companies << parse_company_info(company).merge(primary: company['primaryIndicator'] == 'Yes')
122
+ companies << parse_company_info(company)
123
123
  end
124
124
  end
125
- companies
125
+ companies.flatten
126
126
  end
127
127
 
128
128
  def parse_company_info(company)
129
- security_ids = company.dig('SecurityDetails', 'Security', 'SecurityID')
129
+ securities = company.dig('SecurityDetails', 'Security')
130
+ securities = [securities].compact unless securities.is_a? Array
131
+ securities.map do |security|
132
+ info = { name: (company.dig('IssuerName') || {})['NameValue'], primary: company['primaryIndicator'] == 'Yes' }
133
+ info.merge(parse_security_info(security))
134
+ end
135
+ end
136
+
137
+ def parse_security_info(security)
138
+ security_ids = security.dig('SecurityID')
130
139
  security_ids = [security_ids].compact unless security_ids.is_a? Array
131
- ids = security_ids&.map do |security_id|
140
+ security_ids&.map do |security_id|
132
141
  { security_id['idType'].underscore.to_sym => security_id['idValue'] }
133
142
  end&.reduce({}, :merge) || []
134
- info = { name: (company.dig('IssuerName') || {})['NameValue'] }
135
- info.merge(ids)
136
143
  end
137
144
  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.2.2'
5
- s.date = '2017-04-29'
4
+ s.version = '0.3.0'
5
+ s.date = '2017-07-06'
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.2.2
4
+ version: 0.3.0
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-04-29 00:00:00.000000000 Z
12
+ date: 2017-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler