rixml 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 +4 -4
- data/.rubocop.yml +2 -0
- data/Gemfile.lock +1 -1
- data/lib/rixml.rb +8 -11
- data/rixml.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efdea886c93b2d88eb5ad25f1de042825be18090
|
4
|
+
data.tar.gz: 899bdbcc9cdaeec9987532b0882c2b7a92d2e1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9332413709a18573b7fe3e515b5053db9ac2947ad730dda9481536fc41c1edcb5e0fe1d910eeb2db0cff24e3630301da51776c68443a2c819b773f870d963f39
|
7
|
+
data.tar.gz: b3200cf9d2fea205a2c5c446e501b569769b844be53fa749126892a497289ad631e50c4eb5197e23a78b5b0d07636a6ee7d3eeeb335da8ec945023c63df08037
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/rixml.rb
CHANGED
@@ -55,7 +55,7 @@ class RIXML
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def context
|
58
|
-
context = @attrs.dig('Research', 'Product', 'Context')
|
58
|
+
context = @attrs.dig('Research', 'Product', 'Context') || {}
|
59
59
|
{
|
60
60
|
companies: parse_companies_from_context(context),
|
61
61
|
sectors: parse_sectors_from_context(context),
|
@@ -87,7 +87,7 @@ class RIXML
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def parse_countries_from_context(context)
|
90
|
-
[context['ProductClassifications']&.dig('Country')].flatten.map do |country|
|
90
|
+
[context['ProductClassifications']&.dig('Country')].flatten.compact.map do |country|
|
91
91
|
{ code: country['code'].upcase }
|
92
92
|
end
|
93
93
|
end
|
@@ -95,11 +95,8 @@ class RIXML
|
|
95
95
|
def parse_companies_from_context(context)
|
96
96
|
companies = []
|
97
97
|
[context['IssuerDetails']].flatten.compact.each do |issuer|
|
98
|
-
|
99
|
-
|
100
|
-
list = [list] unless list.is_a? Array
|
101
|
-
list.select { |c| c['issuerType'] == 'Corporate' }.each do |company|
|
102
|
-
companies << parse_company_info(company)
|
98
|
+
[issuer['Issuer']].flatten.compact.select { |c| c['issuerType'] == 'Corporate' }.each do |company|
|
99
|
+
companies << parse_company_info(company).merge(primary: company['primaryIndicator'] == 'Yes')
|
103
100
|
end
|
104
101
|
end
|
105
102
|
companies
|
@@ -107,11 +104,11 @@ class RIXML
|
|
107
104
|
|
108
105
|
def parse_company_info(company)
|
109
106
|
security_ids = company.dig('SecurityDetails', 'Security', 'SecurityID')
|
110
|
-
security_ids = [security_ids] unless security_ids.is_a? Array
|
111
|
-
ids = security_ids
|
107
|
+
security_ids = [security_ids].compact unless security_ids.is_a? Array
|
108
|
+
ids = security_ids&.map do |security_id|
|
112
109
|
{ security_id['idType'].underscore.to_sym => security_id['idValue'] }
|
113
|
-
end
|
114
|
-
info = { name: (company.dig('IssuerName') ||
|
110
|
+
end&.reduce({}, :merge) || []
|
111
|
+
info = { name: (company.dig('IssuerName') || {})['NameValue'] }
|
115
112
|
info.merge(ids)
|
116
113
|
end
|
117
114
|
end
|
data/rixml.gemspec
CHANGED