lib/rixml.rb in rixml-0.4.5 vs lib/rixml.rb in rixml-0.4.6
- old
+ new
@@ -81,11 +81,12 @@
def context
context = @attrs.dig('Research', 'Product', 'Context') || {}
{
companies: parse_companies_from_context(context),
sectors: parse_sectors_from_context(context),
- countries: parse_countries_from_context(context)
+ countries: parse_countries_from_context(context),
+ category: parse_product_category_from_context(context)
}
end
def xpath(path)
@document.xpath(path)
@@ -137,9 +138,13 @@
[issuer['Issuer']].flatten.compact.select { |c| c['issuerType'] == 'Corporate' }.each do |company|
companies << parse_company_info(company)
end
end
companies.flatten
+ end
+
+ def parse_product_category_from_context(context)
+ context.dig('ProductDetails', 'ProductCategory', 'productCategory')
end
def parse_company_info(company)
securities = company.dig('SecurityDetails', 'Security')
securities = [securities].compact unless securities.is_a? Array