oddb2xml 1.8.8 → 1.8.9
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.
- data/.travis.yml +3 -1
- data/Gemfile +5 -1
- data/Gemfile.lock +37 -36
- data/History.txt +4 -0
- data/bin/oddb2xml +4 -2
- data/lib/oddb2xml/builder.rb +13 -3
- data/lib/oddb2xml/version.rb +1 -1
- data/spec/builder_spec.rb +82 -18
- data/spec/cli_spec.rb +6 -6
- data/spec/spec_helper.rb +0 -1
- data/test_options.rb +1 -0
- metadata +33 -5
- checksums.yaml +0 -15
data/.travis.yml
CHANGED
@@ -2,8 +2,9 @@ language: ruby
|
|
2
2
|
|
3
3
|
bundler_args: --without debugger
|
4
4
|
|
5
|
+
cache: bundler
|
6
|
+
|
5
7
|
before_install:
|
6
|
-
- gem update --system 2.1.11
|
7
8
|
- gem --version
|
8
9
|
|
9
10
|
script: bundle exec rspec
|
@@ -12,6 +13,7 @@ rvm:
|
|
12
13
|
- 1.9.3
|
13
14
|
- 2.0.0
|
14
15
|
- 2.1
|
16
|
+
- 2.2
|
15
17
|
- ruby-head
|
16
18
|
|
17
19
|
matrix:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
oddb2xml (1.8.
|
4
|
+
oddb2xml (1.8.9)
|
5
5
|
archive-tar-minitar (~> 0.5.2)
|
6
6
|
mechanize (~> 2.5.1)
|
7
7
|
nokogiri (~> 1.5.10)
|
@@ -20,25 +20,23 @@ GEM
|
|
20
20
|
nokogiri
|
21
21
|
archive-tar-minitar (0.5.2)
|
22
22
|
builder (3.2.2)
|
23
|
+
byebug (3.5.1)
|
24
|
+
columnize (~> 0.8)
|
25
|
+
debugger-linecache (~> 1.2)
|
26
|
+
slop (~> 3.6)
|
23
27
|
coderay (1.1.0)
|
24
|
-
columnize (0.
|
28
|
+
columnize (0.9.0)
|
25
29
|
crack (0.4.2)
|
26
30
|
safe_yaml (~> 1.0.0)
|
27
|
-
debugger (1.6.6)
|
28
|
-
columnize (>= 0.3.1)
|
29
|
-
debugger-linecache (~> 1.2.0)
|
30
|
-
debugger-ruby_core_source (~> 1.3.2)
|
31
31
|
debugger-linecache (1.2.0)
|
32
|
-
debugger-ruby_core_source (1.3.2)
|
33
32
|
diff-lcs (1.2.5)
|
34
|
-
domain_name (0.5.
|
33
|
+
domain_name (0.5.23)
|
35
34
|
unf (>= 0.0.5, < 1.0.0)
|
36
35
|
gyoku (1.1.1)
|
37
36
|
builder (>= 2.1.2)
|
38
|
-
httpi (2.1.
|
37
|
+
httpi (2.1.1)
|
39
38
|
rack
|
40
39
|
rubyntlm (~> 0.3.2)
|
41
|
-
json (1.8.1)
|
42
40
|
mechanize (2.5.1)
|
43
41
|
domain_name (~> 0.5, >= 0.5.1)
|
44
42
|
mime-types (~> 1.17, >= 1.17.2)
|
@@ -54,32 +52,35 @@ GEM
|
|
54
52
|
nokogiri (1.5.11)
|
55
53
|
nori (2.3.0)
|
56
54
|
ntlm-http (0.1.1)
|
57
|
-
pry (0.
|
58
|
-
coderay (~> 1.0)
|
59
|
-
method_source (~> 0.8)
|
55
|
+
pry (0.10.1)
|
56
|
+
coderay (~> 1.1.0)
|
57
|
+
method_source (~> 0.8.1)
|
60
58
|
slop (~> 3.4)
|
61
|
-
pry-
|
62
|
-
|
63
|
-
pry (~> 0.
|
64
|
-
rack (1.
|
65
|
-
rake (10.
|
66
|
-
rdoc (4.
|
67
|
-
|
68
|
-
|
69
|
-
rspec-
|
70
|
-
rspec-
|
71
|
-
|
72
|
-
|
73
|
-
rspec-expectations (
|
74
|
-
diff-lcs (>= 1.
|
75
|
-
|
76
|
-
|
77
|
-
|
59
|
+
pry-byebug (2.0.0)
|
60
|
+
byebug (~> 3.4)
|
61
|
+
pry (~> 0.10)
|
62
|
+
rack (1.6.0)
|
63
|
+
rake (10.4.2)
|
64
|
+
rdoc (4.2.0)
|
65
|
+
rspec (3.1.0)
|
66
|
+
rspec-core (~> 3.1.0)
|
67
|
+
rspec-expectations (~> 3.1.0)
|
68
|
+
rspec-mocks (~> 3.1.0)
|
69
|
+
rspec-core (3.1.7)
|
70
|
+
rspec-support (~> 3.1.0)
|
71
|
+
rspec-expectations (3.1.2)
|
72
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
73
|
+
rspec-support (~> 3.1.0)
|
74
|
+
rspec-mocks (3.1.3)
|
75
|
+
rspec-support (~> 3.1.0)
|
76
|
+
rspec-support (3.1.2)
|
77
|
+
ruby-ole (1.2.11.8)
|
78
|
+
rubyXL (3.3.2)
|
78
79
|
nokogiri (>= 1.4.4)
|
79
|
-
rubyzip (>= 1.
|
80
|
+
rubyzip (>= 1.1.6)
|
80
81
|
rubyntlm (0.3.4)
|
81
82
|
rubyzip (1.1.6)
|
82
|
-
safe_yaml (1.0.
|
83
|
+
safe_yaml (1.0.4)
|
83
84
|
savon (2.4.0)
|
84
85
|
akami (~> 1.2.0)
|
85
86
|
builder (>= 2.1.2)
|
@@ -90,7 +91,7 @@ GEM
|
|
90
91
|
wasabi (~> 3.2.2)
|
91
92
|
sax-machine (0.1.0)
|
92
93
|
nokogiri (> 0.0.0)
|
93
|
-
slop (3.
|
94
|
+
slop (3.6.0)
|
94
95
|
spreadsheet (1.0.0)
|
95
96
|
ruby-ole (>= 1.0)
|
96
97
|
unf (0.1.4)
|
@@ -100,8 +101,8 @@ GEM
|
|
100
101
|
httpi (~> 2.0)
|
101
102
|
mime-types (< 2.0.0)
|
102
103
|
nokogiri (>= 1.4.0)
|
103
|
-
webmock (1.
|
104
|
-
addressable (>= 2.
|
104
|
+
webmock (1.20.4)
|
105
|
+
addressable (>= 2.3.6)
|
105
106
|
crack (>= 0.3.2)
|
106
107
|
webrobots (0.1.1)
|
107
108
|
|
@@ -111,7 +112,7 @@ PLATFORMS
|
|
111
112
|
DEPENDENCIES
|
112
113
|
bundler
|
113
114
|
oddb2xml!
|
114
|
-
pry-
|
115
|
+
pry-byebug
|
115
116
|
rake
|
116
117
|
rdoc
|
117
118
|
rspec
|
data/History.txt
CHANGED
data/bin/oddb2xml
CHANGED
@@ -48,13 +48,15 @@ opts = {
|
|
48
48
|
:ean14 => false,
|
49
49
|
:skip_download=> false,
|
50
50
|
:log => false,
|
51
|
+
:percent => 0,
|
51
52
|
}
|
52
53
|
|
53
54
|
parser.on('-a v', '--append v', /^nonpharma$/) {|v| opts[:nonpharma] = true }
|
54
55
|
parser.on('-c v', '--compress v', /^tar\.gz|zip$/){|v| opts[:compress_ext] = v }
|
55
|
-
parser.on('-e',
|
56
|
-
|
56
|
+
parser.on('-e [x]', '--extended [x]') {|v| opts[:extended] = true
|
57
|
+
opts[:nonpharma] = :true
|
57
58
|
opts[:price] = :zurrose
|
59
|
+
opts[:percent] = v ? v.to_i : 0
|
58
60
|
}
|
59
61
|
parser.on('-f v', '--format v', /^xml|dat$/) {|v| opts[:format] = v.intern }
|
60
62
|
parser.on('-o v', '--option v', /^fi$/) {|v| opts[:fi] = true }
|
data/lib/oddb2xml/builder.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'nokogiri'
|
4
|
+
class Numeric
|
5
|
+
# round a given number to the nearest step
|
6
|
+
def round_by(increment)
|
7
|
+
(self / increment).round * increment
|
8
|
+
end
|
9
|
+
end
|
4
10
|
module Nokogiri
|
5
11
|
module XML
|
6
12
|
class Document < Nokogiri::XML::Node
|
@@ -735,7 +741,12 @@ module Oddb2xml
|
|
735
741
|
xml.ARTPRI {
|
736
742
|
xml.VDAT Time.parse(datetime).strftime("%d.%m.%Y")
|
737
743
|
xml.PTYP "ZURROSEPUB"
|
738
|
-
|
744
|
+
price = info_zur_rose[:pub_price]
|
745
|
+
if @options[:percent] != nil
|
746
|
+
price = (price.to_f*(1 + (@options[:percent].to_f/100))).round_by(0.05).round(2)
|
747
|
+
else
|
748
|
+
end
|
749
|
+
xml.PRICE price
|
739
750
|
}
|
740
751
|
end
|
741
752
|
#xml.ARTMIG {
|
@@ -821,8 +832,7 @@ module Oddb2xml
|
|
821
832
|
info_index[info[:monid]] = i
|
822
833
|
end
|
823
834
|
end
|
824
|
-
@products.group_by{|obj|
|
825
|
-
obj[:no8].to_s[0..4] # swissmedic_number5
|
835
|
+
@products.group_by{|obj| obj[:ean]
|
826
836
|
}.each_pair do |monid, products|
|
827
837
|
if info_index[monid]
|
828
838
|
xml.KP('DT' => '') {
|
data/lib/oddb2xml/version.rb
CHANGED
data/spec/builder_spec.rb
CHANGED
@@ -20,7 +20,7 @@ end
|
|
20
20
|
|
21
21
|
def check_validation_via_xsd
|
22
22
|
@oddb2xml_xsd = File.expand_path(File.join(File.dirname(__FILE__), '..', 'oddb2xml.xsd'))
|
23
|
-
File.exists?(@oddb2xml_xsd).should
|
23
|
+
File.exists?(@oddb2xml_xsd).should eq true
|
24
24
|
files = Dir.glob('*.xml')
|
25
25
|
xsd = Nokogiri::XML::Schema(File.read(@oddb2xml_xsd))
|
26
26
|
files.each{
|
@@ -44,7 +44,7 @@ describe Oddb2xml::Builder do
|
|
44
44
|
after(:each) do
|
45
45
|
Dir.chdir @savedDir if @savedDir and File.directory?(@savedDir)
|
46
46
|
end
|
47
|
-
|
47
|
+
if false
|
48
48
|
context 'XSD-generation: ' do
|
49
49
|
let(:cli) do
|
50
50
|
opts = {}
|
@@ -56,8 +56,8 @@ describe Oddb2xml::Builder do
|
|
56
56
|
|
57
57
|
it 'should return true when validating xml against oddb2xml.xsd' do
|
58
58
|
res = buildr_capture(:stdout){ cli.run }
|
59
|
-
File.exists?(@article_xml).should
|
60
|
-
File.exists?(@product_xml).should
|
59
|
+
File.exists?(@article_xml).should eq true
|
60
|
+
File.exists?(@product_xml).should eq true
|
61
61
|
check_validation_via_xsd
|
62
62
|
end
|
63
63
|
end
|
@@ -86,10 +86,10 @@ describe Oddb2xml::Builder do
|
|
86
86
|
res = buildr_capture(:stdout){ cli.run }
|
87
87
|
res.should match(/products/)
|
88
88
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
89
|
-
File.exists?(@article_xml).should
|
89
|
+
File.exists?(@article_xml).should eq true
|
90
90
|
article_xml = IO.read(@article_xml)
|
91
91
|
product_filename = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_product.xml'))
|
92
|
-
File.exists?(product_filename).should
|
92
|
+
File.exists?(product_filename).should eq true
|
93
93
|
unless /1\.8\.7/.match(RUBY_VERSION)
|
94
94
|
product_xml = IO.read(product_filename)
|
95
95
|
article_xml.should match(/3TC/)
|
@@ -131,7 +131,7 @@ describe Oddb2xml::Builder do
|
|
131
131
|
res = buildr_capture(:stdout){ cli.run }
|
132
132
|
res.should match(/products/)
|
133
133
|
dat_filename = File.join(Oddb2xml::WorkDir, 'oddb.dat')
|
134
|
-
File.exists?(dat_filename).should
|
134
|
+
File.exists?(dat_filename).should eq true
|
135
135
|
oddb_dat = IO.read(dat_filename)
|
136
136
|
oddb_dat.should match(/^..2/), "should have a record with '2' in CMUT field"
|
137
137
|
oddb_dat.should match(/^..3/), "should have a record with '3' in CMUT field"
|
@@ -153,7 +153,7 @@ describe Oddb2xml::Builder do
|
|
153
153
|
res = buildr_capture(:stdout){ cli.run }
|
154
154
|
res.should match(/products/)
|
155
155
|
dat_filename = File.join(Oddb2xml::WorkDir, 'oddb_with_migel.dat')
|
156
|
-
File.exists?(dat_filename).should
|
156
|
+
File.exists?(dat_filename).should eq true
|
157
157
|
oddb_dat = IO.read(dat_filename)
|
158
158
|
oddb_dat.should match(/1115819012LEVETIRACETAM DESITIN Filmtabl 250 mg 30 Stk/), "should have Desitin"
|
159
159
|
# oddb_dat.should match(/001349002780100B010710076806206900842/), "should match EAN of Desitin"
|
@@ -163,12 +163,11 @@ describe Oddb2xml::Builder do
|
|
163
163
|
res = buildr_capture(:stdout){ cli.run }
|
164
164
|
res.should match(/products/)
|
165
165
|
dat_filename = File.join(Oddb2xml::WorkDir, 'oddb_with_migel.dat')
|
166
|
-
File.exists?(dat_filename).should
|
166
|
+
File.exists?(dat_filename).should eq true
|
167
167
|
oddb_dat = IO.read(dat_filename)
|
168
168
|
oddb_dat.should match(/76806206900842/), "should match EAN of Desitin"
|
169
169
|
end
|
170
170
|
end
|
171
|
-
|
172
171
|
context 'when option -e is given' do
|
173
172
|
let(:cli) do
|
174
173
|
opts = {
|
@@ -194,7 +193,7 @@ describe Oddb2xml::Builder do
|
|
194
193
|
it 'should generate the flag non-refdata' do
|
195
194
|
res = buildr_capture(:stdout){ cli.run }
|
196
195
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
197
|
-
File.exists?(@article_xml).should
|
196
|
+
File.exists?(@article_xml).should eq true
|
198
197
|
FileUtils.cp(@article_xml, File.join(Oddb2xml::WorkDir, 'tst-non-refdata.xml'))
|
199
198
|
article_xml = IO.read(@article_xml)
|
200
199
|
doc = REXML::Document.new File.new(@article_xml)
|
@@ -224,7 +223,7 @@ describe Oddb2xml::Builder do
|
|
224
223
|
res.should match(/NonPharma/i)
|
225
224
|
res.should match(/NonPharma products: #{NrPharmaAndNonPharmaArticles}/)
|
226
225
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
227
|
-
File.exists?(@article_xml).should
|
226
|
+
File.exists?(@article_xml).should eq true
|
228
227
|
article_xml = IO.read(@article_xml)
|
229
228
|
doc = REXML::Document.new File.new(@article_xml)
|
230
229
|
dscrds = XPath.match( doc, "//ART" )
|
@@ -237,7 +236,7 @@ describe Oddb2xml::Builder do
|
|
237
236
|
res.should match(/NonPharma/i)
|
238
237
|
res.should match(/NonPharma products: #{NrPharmaAndNonPharmaArticles}/)
|
239
238
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
240
|
-
File.exists?(@article_xml).should
|
239
|
+
File.exists?(@article_xml).should eq true
|
241
240
|
article_xml = IO.read(@article_xml)
|
242
241
|
doc = REXML::Document.new File.new(@article_xml)
|
243
242
|
dscrds = XPath.match( doc, "//ART" )
|
@@ -252,7 +251,7 @@ describe Oddb2xml::Builder do
|
|
252
251
|
res.should match(/NonPharma/i)
|
253
252
|
res.should match(/NonPharma products: #{NrPharmaAndNonPharmaArticles}/)
|
254
253
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
255
|
-
File.exists?(@article_xml).should
|
254
|
+
File.exists?(@article_xml).should eq true
|
256
255
|
article_xml = IO.read(@article_xml)
|
257
256
|
doc = REXML::Document.new File.new(@article_xml)
|
258
257
|
dscrds = XPath.match( doc, "//ART" )
|
@@ -266,7 +265,7 @@ describe Oddb2xml::Builder do
|
|
266
265
|
res = buildr_capture(:stdout){ cli.run }
|
267
266
|
# check limitations
|
268
267
|
limitation_filename = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_limitation.xml'))
|
269
|
-
File.exists?(limitation_filename).should
|
268
|
+
File.exists?(limitation_filename).should eq true
|
270
269
|
limitation_xml = IO.read(limitation_filename)
|
271
270
|
limitation_xml.should match(/Die aufgeführten Präparat/)
|
272
271
|
doc = REXML::Document.new File.new(limitation_filename)
|
@@ -281,7 +280,7 @@ describe Oddb2xml::Builder do
|
|
281
280
|
it 'should emit a correct oddb_article.xml' do
|
282
281
|
res = buildr_capture(:stdout){ cli.run }
|
283
282
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
284
|
-
File.exists?(@article_xml).should
|
283
|
+
File.exists?(@article_xml).should eq true
|
285
284
|
article_xml = IO.read(@article_xml)
|
286
285
|
doc = REXML::Document.new File.new(@article_xml)
|
287
286
|
unless /1\.8\.7/.match(RUBY_VERSION)
|
@@ -338,7 +337,7 @@ describe Oddb2xml::Builder do
|
|
338
337
|
res = buildr_capture(:stdout){ cli.run }
|
339
338
|
res.should match(/products/)
|
340
339
|
product_filename = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_product.xml'))
|
341
|
-
File.exists?(product_filename).should
|
340
|
+
File.exists?(product_filename).should eq true
|
342
341
|
|
343
342
|
unless /1\.8\.7/.match(RUBY_VERSION)
|
344
343
|
# check articles
|
@@ -370,7 +369,7 @@ describe Oddb2xml::Builder do
|
|
370
369
|
it 'should generate the flag SALECD' do
|
371
370
|
res = buildr_capture(:stdout){ cli.run }
|
372
371
|
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
373
|
-
File.exists?(@article_xml).should
|
372
|
+
File.exists?(@article_xml).should eq true
|
374
373
|
FileUtils.cp(@article_xml, File.join(Oddb2xml::WorkDir, 'tst-SALECD.xml'))
|
375
374
|
article_xml = IO.read(@article_xml)
|
376
375
|
doc = REXML::Document.new File.new(@article_xml)
|
@@ -379,4 +378,69 @@ describe Oddb2xml::Builder do
|
|
379
378
|
checkItemForSALECD(doc, "0598003", 'I') # SOFRADEX
|
380
379
|
end
|
381
380
|
end
|
381
|
+
end
|
382
|
+
context 'testing -e option' do
|
383
|
+
let(:cli) do
|
384
|
+
opts = {
|
385
|
+
:extended => :true,
|
386
|
+
:skip_download => true,
|
387
|
+
}
|
388
|
+
Oddb2xml::Cli.new(opts)
|
389
|
+
end
|
390
|
+
|
391
|
+
let(:cli_e80) do
|
392
|
+
opts = {
|
393
|
+
:extended => :true,
|
394
|
+
:percent => 80,
|
395
|
+
:skip_download => true,
|
396
|
+
}
|
397
|
+
Oddb2xml::Cli.new(opts)
|
398
|
+
end
|
399
|
+
search_path_rose = "//ART[PHAR=0023722]/ARTPRI[PTYP='ZURROSE']/PRICE"
|
400
|
+
search_path_pub = "//ART[PHAR=0023722]/ARTPRI[PTYP='ZURROSEPUB']/PRICE"
|
401
|
+
# sl-entries have a PPUB price
|
402
|
+
search_path_desitin = "//ART[SMNO='62069008']/ARTPRI[PTYP='PPUB']/PRICE"
|
403
|
+
|
404
|
+
it 'should should return the ZurRose prive if -e' do
|
405
|
+
res = buildr_capture(:stdout){ cli.run }
|
406
|
+
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
407
|
+
File.exists?(@article_xml).should eq true
|
408
|
+
FileUtils.cp(@article_xml, File.join(Oddb2xml::WorkDir, 'tst-e.xml'))
|
409
|
+
article_xml = IO.read(@article_xml)
|
410
|
+
doc = REXML::Document.new File.new(@article_xml)
|
411
|
+
XPath.match( doc, "//REF_DATA" ).size.should > 0
|
412
|
+
article = XPath.match( doc, "//ART[PHAR=0023722]").first
|
413
|
+
name = article.elements['DSCRD'].text
|
414
|
+
refdata = article.elements['REF_DATA'].text
|
415
|
+
smno = article.elements['SMNO'] ? article.elements['SMNO'].text : 'nil'
|
416
|
+
XPath.match( doc, search_path_rose).size.should eq 1
|
417
|
+
XPath.match( doc, search_path_rose).first.text.should eq '9.85'
|
418
|
+
price = 15.20 # This is the zurrose pub price.
|
419
|
+
XPath.match( doc, search_path_pub).first.text.to_f.should eq price
|
420
|
+
XPath.match( doc, search_path_desitin).first.text.should eq '27.8'
|
421
|
+
end
|
422
|
+
|
423
|
+
it 'should add 80 percent to zur_rose pubbprice if -e 80' do
|
424
|
+
res = buildr_capture(:stdout){ cli_e80.run }
|
425
|
+
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
426
|
+
File.exists?(@article_xml).should eq true
|
427
|
+
FileUtils.cp(@article_xml, File.join(Oddb2xml::WorkDir, 'tst-e80.xml'))
|
428
|
+
article_xml = IO.read(@article_xml)
|
429
|
+
doc = REXML::Document.new File.new(@article_xml)
|
430
|
+
article = XPath.match( doc, "//ART[PHAR=0023722]").first
|
431
|
+
name = article.elements['DSCRD'].text
|
432
|
+
refdata = article.elements['REF_DATA'].text
|
433
|
+
smno = article.elements['SMNO'] ? article.elements['SMNO'].text : 'nil'
|
434
|
+
XPath.match( doc, search_path_rose).size.should eq 1
|
435
|
+
XPath.match( doc, search_path_rose).first.text.should eq '9.85'
|
436
|
+
price = 15.20 # This is the zurrose pub price.
|
437
|
+
price2 = (price*1.8).round_by(0.05).round(2) # Our price should be now 80% higher
|
438
|
+
XPath.match( doc, search_path_pub).first.text
|
439
|
+
XPath.match( doc, search_path_pub).first.text.to_f.should eq price2
|
440
|
+
XPath.match( doc, search_path_desitin).first.text.should eq '27.8'
|
441
|
+
# sl-entries have a PPUB price, but no ZURROSEPUB, and vice versa
|
442
|
+
XPath.match( doc, "//ART[PHAR=0023722]/ARTPRI[PTYP='PPUB']").size.should eq 0
|
443
|
+
XPath.match( doc, "//ART[SMNO='62069008']/ARTPRI[PTYP='ZURROSEPUB']").size.should eq 0
|
444
|
+
end
|
445
|
+
end
|
382
446
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -74,7 +74,7 @@ describe Oddb2xml::Cli do
|
|
74
74
|
it 'should create tar.gz file' do
|
75
75
|
cli_capture(:stdout) { cli.run }.should match(/Pharma/)
|
76
76
|
file = Dir.glob(File.join(Dir.pwd, 'oddb_*.tar.gz')).first
|
77
|
-
File.exists?(file).should
|
77
|
+
File.exists?(file).should eq true
|
78
78
|
end
|
79
79
|
it 'should not create any xml file' do
|
80
80
|
cli_capture(:stdout) { cli.run }.should match(/Pharma/)
|
@@ -101,7 +101,7 @@ describe Oddb2xml::Cli do
|
|
101
101
|
it 'should create zip file' do
|
102
102
|
cli_capture(:stdout) { cli.run }.should match(/Pharma/)
|
103
103
|
file = Dir.glob(File.join(Dir.pwd, 'oddb_*.zip')).first
|
104
|
-
File.exists?(file).should
|
104
|
+
File.exists?(file).should eq true
|
105
105
|
end
|
106
106
|
it 'should not create any xml file' do
|
107
107
|
Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file| FileUtil.rm_f(file) end
|
@@ -142,7 +142,7 @@ describe Oddb2xml::Cli do
|
|
142
142
|
'oddb_code.xml'
|
143
143
|
].length
|
144
144
|
Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
|
145
|
-
File.exists?(file).should
|
145
|
+
File.exists?(file).should eq true
|
146
146
|
end.to_a.length.should equal expected
|
147
147
|
end
|
148
148
|
end
|
@@ -177,7 +177,7 @@ describe Oddb2xml::Cli do
|
|
177
177
|
'swiss_code.xml'
|
178
178
|
].length
|
179
179
|
Dir.glob(File.join(Oddb2xml::WorkDir, 'swiss_*.xml')).each do |file|
|
180
|
-
File.exists?(file).should
|
180
|
+
File.exists?(file).should eq true
|
181
181
|
end.to_a.length.should equal expected
|
182
182
|
end
|
183
183
|
end
|
@@ -214,7 +214,7 @@ describe Oddb2xml::Cli do
|
|
214
214
|
'oddb_code.xml'
|
215
215
|
].length
|
216
216
|
Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
|
217
|
-
File.exists?(file).should
|
217
|
+
File.exists?(file).should eq true
|
218
218
|
end.to_a.length.should equal expected
|
219
219
|
end
|
220
220
|
end
|
@@ -245,7 +245,7 @@ describe Oddb2xml::Cli do
|
|
245
245
|
'oddb_medizinalperson.xml',
|
246
246
|
].length
|
247
247
|
Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_*.xml')).each do |file|
|
248
|
-
File.exists?(file).should
|
248
|
+
File.exists?(file).should eq true
|
249
249
|
end.to_a.length.should equal expected
|
250
250
|
end
|
251
251
|
end
|
data/spec/spec_helper.rb
CHANGED
data/test_options.rb
CHANGED
@@ -49,6 +49,7 @@ prepare_for_gem_test
|
|
49
49
|
# unfortunately it returns a very common name
|
50
50
|
unless 'localhost.localdomain'.eql?(Socket.gethostbyname(Socket.gethostname).first)
|
51
51
|
test_one_call('oddb2xml -e')
|
52
|
+
test_one_call('oddb2xml -e80')
|
52
53
|
test_one_call('oddb2xml -f dat -a nonpharma')
|
53
54
|
test_one_call('oddb2xml -a nonpharma')
|
54
55
|
end
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.9
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Yasuhiro Asaka, Zeno R.R. Davatz
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rubyzip
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: archive-tar-minitar
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: mechanize
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: nokogiri
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: savon
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ~>
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :runtime
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ~>
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,6 +94,7 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: spreadsheet
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
99
|
- - ~>
|
88
100
|
- !ruby/object:Gem::Version
|
@@ -90,6 +102,7 @@ dependencies:
|
|
90
102
|
type: :runtime
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - ~>
|
95
108
|
- !ruby/object:Gem::Version
|
@@ -97,6 +110,7 @@ dependencies:
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: rubyXL
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
115
|
- - ~>
|
102
116
|
- !ruby/object:Gem::Version
|
@@ -104,6 +118,7 @@ dependencies:
|
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
123
|
- - ~>
|
109
124
|
- !ruby/object:Gem::Version
|
@@ -111,6 +126,7 @@ dependencies:
|
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: sax-machine
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
131
|
- - ~>
|
116
132
|
- !ruby/object:Gem::Version
|
@@ -118,6 +134,7 @@ dependencies:
|
|
118
134
|
type: :runtime
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
139
|
- - ~>
|
123
140
|
- !ruby/object:Gem::Version
|
@@ -125,6 +142,7 @@ dependencies:
|
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
143
|
name: bundler
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
128
146
|
requirements:
|
129
147
|
- - ! '>='
|
130
148
|
- !ruby/object:Gem::Version
|
@@ -132,6 +150,7 @@ dependencies:
|
|
132
150
|
type: :development
|
133
151
|
prerelease: false
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
135
154
|
requirements:
|
136
155
|
- - ! '>='
|
137
156
|
- !ruby/object:Gem::Version
|
@@ -139,6 +158,7 @@ dependencies:
|
|
139
158
|
- !ruby/object:Gem::Dependency
|
140
159
|
name: rake
|
141
160
|
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
142
162
|
requirements:
|
143
163
|
- - ! '>='
|
144
164
|
- !ruby/object:Gem::Version
|
@@ -146,6 +166,7 @@ dependencies:
|
|
146
166
|
type: :development
|
147
167
|
prerelease: false
|
148
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
149
170
|
requirements:
|
150
171
|
- - ! '>='
|
151
172
|
- !ruby/object:Gem::Version
|
@@ -153,6 +174,7 @@ dependencies:
|
|
153
174
|
- !ruby/object:Gem::Dependency
|
154
175
|
name: rspec
|
155
176
|
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
156
178
|
requirements:
|
157
179
|
- - ! '>='
|
158
180
|
- !ruby/object:Gem::Version
|
@@ -160,6 +182,7 @@ dependencies:
|
|
160
182
|
type: :development
|
161
183
|
prerelease: false
|
162
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
163
186
|
requirements:
|
164
187
|
- - ! '>='
|
165
188
|
- !ruby/object:Gem::Version
|
@@ -167,6 +190,7 @@ dependencies:
|
|
167
190
|
- !ruby/object:Gem::Dependency
|
168
191
|
name: webmock
|
169
192
|
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
170
194
|
requirements:
|
171
195
|
- - ! '>='
|
172
196
|
- !ruby/object:Gem::Version
|
@@ -174,6 +198,7 @@ dependencies:
|
|
174
198
|
type: :development
|
175
199
|
prerelease: false
|
176
200
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
177
202
|
requirements:
|
178
203
|
- - ! '>='
|
179
204
|
- !ruby/object:Gem::Version
|
@@ -181,6 +206,7 @@ dependencies:
|
|
181
206
|
- !ruby/object:Gem::Dependency
|
182
207
|
name: rdoc
|
183
208
|
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
184
210
|
requirements:
|
185
211
|
- - ! '>='
|
186
212
|
- !ruby/object:Gem::Version
|
@@ -188,6 +214,7 @@ dependencies:
|
|
188
214
|
type: :development
|
189
215
|
prerelease: false
|
190
216
|
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
191
218
|
requirements:
|
192
219
|
- - ! '>='
|
193
220
|
- !ruby/object:Gem::Version
|
@@ -276,26 +303,27 @@ files:
|
|
276
303
|
homepage: https://github.com/zdavatz/oddb2xml
|
277
304
|
licenses:
|
278
305
|
- GPL-v2
|
279
|
-
metadata: {}
|
280
306
|
post_install_message:
|
281
307
|
rdoc_options: []
|
282
308
|
require_paths:
|
283
309
|
- lib
|
284
310
|
required_ruby_version: !ruby/object:Gem::Requirement
|
311
|
+
none: false
|
285
312
|
requirements:
|
286
313
|
- - ! '>='
|
287
314
|
- !ruby/object:Gem::Version
|
288
315
|
version: '0'
|
289
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
|
+
none: false
|
290
318
|
requirements:
|
291
319
|
- - ! '>='
|
292
320
|
- !ruby/object:Gem::Version
|
293
321
|
version: '0'
|
294
322
|
requirements: []
|
295
323
|
rubyforge_project:
|
296
|
-
rubygems_version:
|
324
|
+
rubygems_version: 1.8.25
|
297
325
|
signing_key:
|
298
|
-
specification_version:
|
326
|
+
specification_version: 3
|
299
327
|
summary: oddb2xml creates xml files.
|
300
328
|
test_files:
|
301
329
|
- spec/builder_spec.rb
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NzM4YTgxNmRjNWRkMmEyNTFmNTMyZDdjZDBiZTJhZWYzMTg5MDAwOA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZmM0ZTkxZmRjODJlMTZlOGIxY2M3YzRhYmEzOGFjNDIyMDBhMmE4Nw==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MzhiNWMzNTU1NGU0NDkxZTg4M2QyZjU5NDc4MGNmMDhmM2M4ODEwYmRjOTIw
|
10
|
-
NzJhM2M5MzFmYTRmZmJkNGM5MTMyMTEzMDk3OWFmN2E1ZmVmNzFmY2Y1NjJm
|
11
|
-
NTc2ODY1MjE3MDcwODE2YWE5ZWY4MzZhOGQ2ZjMyZmRhYTljMzc=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDY2MzAxMmMyNDE1ZGU1YTg3YzllNzVhZWVmM2NiMThhYWE1NmUwZDZlZDI0
|
14
|
-
MDRhZTU3NWI0ZjhhNGJhNGQxMzVlYWU0MDVlMzhlM2QyOWMzYzljMmFjMGVh
|
15
|
-
NDU5MTBhZGJlY2QxNGJmYTUyMWZiNTJhZWM1OWU2NjBhZThiOGM=
|