djnml 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/djnml.gemspec +2 -2
  3. data/lib/djnml.rb +53 -6
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/djnml.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{djnml}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tobias Begalke"]
12
- s.date = %q{2012-07-30}
12
+ s.date = %q{2012-09-05}
13
13
  s.description = %q{This ruby library parses Dow Jones NML files into a DJNML object}
14
14
  s.email = %q{elcamino@spyz.org}
15
15
  s.extra_rdoc_files = [
data/lib/djnml.rb CHANGED
@@ -51,6 +51,58 @@ class DJNML
51
51
  :delete, :modifications
52
52
 
53
53
 
54
+ def initialize(data = {})
55
+ @msize = data['msize'].to_i
56
+ @md5 = data['md5']
57
+ @sys_id = data['sys_id']
58
+ @destination = data['destination']
59
+ @dist_id = data['dist_id']
60
+ @transmission_date = Time.parse(data['transmission_date'])
61
+ @publisher = data['publisher']
62
+ @doc_date = Time.parse(data['doc_date'])
63
+ @product = data['product']
64
+ @seq = data['seq'].to_i
65
+ @lang = data['lang']
66
+ @news_source = data['news_source']
67
+ @origin = data['origin']
68
+ @service_id = data['service_id']
69
+ @urgency = data['urgency']
70
+ @brand = data['brand']
71
+ @temp_perm = data['temp_perm']
72
+ @retention = data['retention']
73
+ @hot = data['hot']
74
+ @original_source = data['original_source']
75
+ @accession_number = data['accession_number']
76
+ @page_citation = data['page_citation']
77
+ @display_date = Time.parse(data['display_date'])
78
+ @company_code = data['company_code']
79
+ @isin_code = data['isin_code']
80
+ @page_code = data['page_code']
81
+ @industry_code = data['industry_code'].to_a.map { |c| Codes.new(c) }
82
+ @government_code = data['government_code'].to_a.map { |c| Codes.new(c) }
83
+ @subject_code = data['subject_code'].to_a.map { |c| Codes.new(c) }
84
+ @market_code = data['market_code'].to_a.map { |c| Codes.new(c) }
85
+ @product_code = data['product_code'].to_a.map { |c| Codes.new(c) }
86
+ @geo_code = data['geo_code'].to_a.map { |c| Codes.new(c) }
87
+ @stat_code = data['stat_code'].to_a.map { |c| Codes.new(c) }
88
+ @journal_code = data['stat_code'].to_a.map { |c| Codes.new(c) }
89
+ @routing_code = data['routing_code'].to_a.map { |c| Codes.new(c) }
90
+ @content_code = data['content_code'].to_a.map { |c| Codes.new(c) }
91
+ @function_code = data['function_code'].to_a.map { |c| Codes.new(c) }
92
+ @headline = data['headline']
93
+ @headline_brand = data['headline_brand']
94
+ @html = data['html']
95
+ @text = data['text']
96
+ @copyright_year = data['copyright_year']
97
+ @copyright_holder = data['copyright_holder']
98
+ @website = data['website']
99
+ @company_name = data['company_name']
100
+ @company_address= data['company_address']
101
+ @company_zip = data['company_zip']
102
+ @company_city = data['company_city']
103
+ @language = data['language']
104
+ end
105
+
54
106
  def self.load(filename)
55
107
 
56
108
  if filename
@@ -99,7 +151,7 @@ class DJNML
99
151
  # ignore errors
100
152
  end
101
153
 
102
- djnml = nil
154
+ djnml = nil
103
155
 
104
156
  # djn-newswires tag
105
157
  #
@@ -390,7 +442,6 @@ class DJNML
390
442
  # replacements
391
443
  #
392
444
  @modifications = []
393
- # begin
394
445
  doc_modify = parser.search('/doc/djnml/administration/doc-modify').first
395
446
 
396
447
  mods = parser.search('/doc/djnml/administration/doc-modify/modify-replace')
@@ -401,10 +452,6 @@ class DJNML
401
452
  :seq => doc_modify['seq'],
402
453
  :xml => m)
403
454
  end
404
- # rescue Exception => e
405
- # ignore errors
406
- # end
407
-
408
455
  self
409
456
  end
410
457
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: djnml
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tobias Begalke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-07-30 00:00:00 +02:00
13
+ date: 2012-09-05 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- hash: 4435593055381432029
139
+ hash: 587889234958476553
140
140
  segments:
141
141
  - 0
142
142
  version: "0"