rixml 0.4.6 → 0.4.7

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 +23 -2
  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: 0cbf52afd7ee5b9ba7972a7fa01e6ae340f10f00
4
- data.tar.gz: 96a6d6bfe25f1e47082c9a54d2ceef36344681ec
3
+ metadata.gz: 8845e241347fc96859add967aa3f6a47cb59f7bb
4
+ data.tar.gz: 1025ab975104eb8853e7eddc5e9537c3761240f1
5
5
  SHA512:
6
- metadata.gz: f98cea37b0ce723213472e22db13190fa364644dd8f2d759c804b4d87f8140d31f5172b5a70e9a68744b0984bc9b002f53df7514d835d9f21cb1d2a70e4dd244
7
- data.tar.gz: 866bd8bed74d7fa821982eacc93b69f7bc4f7def9b0b598cd113ed7fa0c7546a2c8d5e0e434e949c3ec492d0efc8a351861b25a6570da08843f64bb1ade5dda5
6
+ metadata.gz: 6c45dc3510cd8f756332a24bfece35c2811000bfe4fba8f3779419002321c55d8f412b08fd37322a0f4379b1c967c5a80260025b5cfafabcaa0e235b52fa8bf4
7
+ data.tar.gz: bf361daf21cdb69a8fc8dc3af66d9d2423b3e9689dfe827675f67e05893e32f5bfd49ddec6aa7e0ec80757983f1b2eb0d0d177e9a443f4bf71a7954122b581ff
data/lib/rixml.rb CHANGED
@@ -84,7 +84,8 @@ class RIXML
84
84
  companies: parse_companies_from_context(context),
85
85
  sectors: parse_sectors_from_context(context),
86
86
  countries: parse_countries_from_context(context),
87
- category: parse_product_category_from_context(context)
87
+ category: parse_product_category_from_context(context),
88
+ publication_date: parse_publication_date_from_context(context)
88
89
  }
89
90
  end
90
91
 
@@ -113,10 +114,26 @@ class RIXML
113
114
  middle_name: person['MiddleName'],
114
115
  last_name: person['FamilyName'],
115
116
  job_title: person['JobTitle'],
116
- email: person['ContactInfo']&.dig('Email')&.downcase
117
+ email: person['ContactInfo']&.dig('Email')&.downcase, # TODO: Remove: Use email from contacts
118
+ contacts: parse_author_contacts(person['ContactInfo'])
117
119
  }
118
120
  end
119
121
 
122
+ def parse_author_contacts(contacts)
123
+ contacts = [contacts] unless contacts.is_a? Array
124
+
125
+ contacts.map do |contact|
126
+ {
127
+ email: contact&.dig('Email')&.downcase,
128
+ phone: parse_author_contact_phone(contact&.dig('Phone'))
129
+ }
130
+ end
131
+ end
132
+
133
+ def parse_author_contact_phone(phone)
134
+ [phone['CountryCode'], phone['Number']].join(' ') if phone
135
+ end
136
+
120
137
  def parse_sectors_from_context(context)
121
138
  list = context['ProductClassifications'].try(:[], 'SectorIndustry')
122
139
  return [] if list.nil?
@@ -146,6 +163,10 @@ class RIXML
146
163
  context.dig('ProductDetails', 'ProductCategory', 'productCategory')
147
164
  end
148
165
 
166
+ def parse_publication_date_from_context(context)
167
+ context.dig('ProductDetails', 'publicationDateTime')
168
+ end
169
+
149
170
  def parse_company_info(company)
150
171
  securities = company.dig('SecurityDetails', 'Security')
151
172
  securities = [securities].compact unless securities.is_a? Array
data/rixml.gemspec CHANGED
@@ -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.6'
5
- s.date = '2017-09-11'
4
+ s.version = '0.4.7'
5
+ s.date = '2017-09-17'
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.6
4
+ version: 0.4.7
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-11 00:00:00.000000000 Z
12
+ date: 2017-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler