oddb2xml 2.2.9 → 2.3.0
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/Gemfile.lock +7 -7
- data/History.txt +4 -0
- data/lib/oddb2xml/builder.rb +37 -16
- data/lib/oddb2xml/version.rb +1 -1
- data/spec/builder_spec.rb +55 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ab40ef8c4f53f94608a1e9fc3b0b7a374ef5792
|
4
|
+
data.tar.gz: 6d9f87677f27a84001f543383a39a1eff8d67590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 626a02b6dab71eda2290cd3dc8197f622e5cd6ad1884e113b4f4aa0bb252f3e480bc20b9cb9be6dd202b7dff0313aaf7e68171e359c91279572b531dd31b36ce
|
7
|
+
data.tar.gz: 0239307754df9f22d634e814da89bfe8430c6aa14b33774c0cbeaa61f2f09e2469b2999cf8e19e3722f39ec8ab3e40fad8ee0e8ca0534d8492cc6ce19a3db000
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
oddb2xml (2.
|
4
|
+
oddb2xml (2.3.0)
|
5
5
|
archive-tar-minitar
|
6
6
|
httpi (>= 2.4.1)
|
7
7
|
mechanize
|
@@ -51,12 +51,12 @@ GEM
|
|
51
51
|
webrobots (>= 0.0.9, < 0.2)
|
52
52
|
method_source (0.8.2)
|
53
53
|
mime-types (2.99)
|
54
|
-
|
54
|
+
mini_portile2 (2.0.0)
|
55
55
|
multi_json (1.11.2)
|
56
56
|
net-http-digest_auth (1.4)
|
57
57
|
net-http-persistent (2.9.4)
|
58
|
-
nokogiri (1.6.
|
59
|
-
|
58
|
+
nokogiri (1.6.7)
|
59
|
+
mini_portile2 (~> 2.0.0.rc2)
|
60
60
|
nori (2.6.0)
|
61
61
|
ntlm-http (0.1.1)
|
62
62
|
parslet (1.7.1)
|
@@ -105,8 +105,8 @@ GEM
|
|
105
105
|
wasabi (~> 3.4)
|
106
106
|
sax-machine (1.3.2)
|
107
107
|
slop (3.6.0)
|
108
|
-
spreadsheet (1.
|
109
|
-
ruby-ole (
|
108
|
+
spreadsheet (1.1.1)
|
109
|
+
ruby-ole (~> 1.0)
|
110
110
|
timecop (0.8.0)
|
111
111
|
unf (0.1.4)
|
112
112
|
unf_ext
|
@@ -138,4 +138,4 @@ DEPENDENCIES
|
|
138
138
|
webmock
|
139
139
|
|
140
140
|
BUNDLED WITH
|
141
|
-
1.10.
|
141
|
+
1.10.6
|
data/History.txt
CHANGED
data/lib/oddb2xml/builder.rb
CHANGED
@@ -273,18 +273,20 @@ module Oddb2xml
|
|
273
273
|
) {
|
274
274
|
Oddb2xml.log "build_substance #{@substances.size} substances"
|
275
275
|
exit 2 if @options[:extended] and @substances.size == 0
|
276
|
+
nbr_records = 0
|
276
277
|
@substances.each_with_index do |sub_name, i|
|
277
|
-
xml.SB('DT' => '')
|
278
|
+
xml.SB('DT' => '') do
|
278
279
|
xml.SUBNO((i + 1).to_i)
|
279
280
|
#xml.NAMD
|
280
281
|
#xml.ANAMD
|
281
282
|
#xml.NAMF
|
282
283
|
xml.NAML sub_name
|
283
|
-
|
284
|
+
nbr_records += 1
|
285
|
+
end
|
284
286
|
end
|
285
287
|
xml.RESULT {
|
286
288
|
xml.OK_ERROR 'OK'
|
287
|
-
xml.NBR_RECORD
|
289
|
+
xml.NBR_RECORD nbr_records
|
288
290
|
xml.ERROR_CODE ''
|
289
291
|
xml.MESSAGE ''
|
290
292
|
}
|
@@ -299,6 +301,7 @@ module Oddb2xml
|
|
299
301
|
xml.doc.tag_suffix = @tag_suffix
|
300
302
|
datetime = Time.new.strftime('%FT%T%z')
|
301
303
|
xml.LIMITATION(XML_OPTIONS) {
|
304
|
+
nbr_records = 0
|
302
305
|
@limitations.each do |lim|
|
303
306
|
xml.LIM('DT' => '') {
|
304
307
|
case lim[:key]
|
@@ -320,11 +323,13 @@ module Oddb2xml
|
|
320
323
|
if lim[:del]
|
321
324
|
xml.DEL 3
|
322
325
|
end
|
326
|
+
nbr_records += 1
|
327
|
+
|
323
328
|
}
|
324
329
|
end
|
325
330
|
xml.RESULT {
|
326
331
|
xml.OK_ERROR 'OK'
|
327
|
-
xml.NBR_RECORD
|
332
|
+
xml.NBR_RECORD nbr_records
|
328
333
|
xml.ERROR_CODE ''
|
329
334
|
xml.MESSAGE ''
|
330
335
|
}
|
@@ -335,6 +340,7 @@ module Oddb2xml
|
|
335
340
|
def build_interaction
|
336
341
|
prepare_interactions
|
337
342
|
prepare_codes
|
343
|
+
nbr_records = 0
|
338
344
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
339
345
|
xml.doc.tag_suffix = @tag_suffix
|
340
346
|
datetime = Time.new.strftime('%FT%T%z')
|
@@ -378,11 +384,12 @@ module Oddb2xml
|
|
378
384
|
# xml.TXTD
|
379
385
|
# xml.TXTF
|
380
386
|
#}
|
387
|
+
nbr_records += 1
|
381
388
|
}
|
382
389
|
end
|
383
390
|
xml.RESULT {
|
384
391
|
xml.OK_ERROR 'OK'
|
385
|
-
xml.NBR_RECORD
|
392
|
+
xml.NBR_RECORD nbr_records
|
386
393
|
xml.ERROR_CODE ''
|
387
394
|
xml.MESSAGE ''
|
388
395
|
}
|
@@ -392,6 +399,7 @@ module Oddb2xml
|
|
392
399
|
end
|
393
400
|
def build_code
|
394
401
|
prepare_codes
|
402
|
+
nbr_records = 0
|
395
403
|
Oddb2xml.log "build_code #{@codes.size} codes"
|
396
404
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
397
405
|
xml.doc.tag_suffix = @tag_suffix
|
@@ -408,11 +416,12 @@ module Oddb2xml
|
|
408
416
|
#xml.DSCRD
|
409
417
|
#xml.DSCRF
|
410
418
|
xml.DEL false
|
419
|
+
nbr_records += 1
|
411
420
|
}
|
412
421
|
end
|
413
422
|
xml.RESULT {
|
414
423
|
xml.OK_ERROR 'OK'
|
415
|
-
xml.NBR_RECORD
|
424
|
+
xml.NBR_RECORD nbr_records
|
416
425
|
xml.ERROR_CODE ''
|
417
426
|
xml.MESSAGE ''
|
418
427
|
}
|
@@ -451,6 +460,7 @@ module Oddb2xml
|
|
451
460
|
prepare_interactions
|
452
461
|
prepare_codes
|
453
462
|
add_missing_products_from_swissmedic
|
463
|
+
nbr_records = 0
|
454
464
|
Oddb2xml.log "build_product #{@products.size+@missing.size} products"
|
455
465
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
456
466
|
xml.doc.tag_suffix = @tag_suffix
|
@@ -491,7 +501,7 @@ module Oddb2xml
|
|
491
501
|
next if /^Q/i.match(obj[:atc])
|
492
502
|
seq = obj[:seq]
|
493
503
|
length += 1
|
494
|
-
xml.PRD('DT' => obj[:last_change])
|
504
|
+
xml.PRD('DT' => obj[:last_change]) do
|
495
505
|
ean = obj[:ean]
|
496
506
|
xml.GTIN ean
|
497
507
|
ppac = ((_ppac = @packs[ean.to_s[4..11].intern] and !_ppac[:is_tier]) ? _ppac : {})
|
@@ -608,11 +618,12 @@ module Oddb2xml
|
|
608
618
|
xml.EinheitSwissmedic obj[:eht] unless obj[:eht].empty?
|
609
619
|
xml.SubstanceSwissmedic obj[:sub] unless obj[:sub].empty?
|
610
620
|
xml.CompositionSwissmedic obj[:comp] unless obj[:comp].empty?
|
611
|
-
|
621
|
+
nbr_records += 1
|
622
|
+
end
|
612
623
|
end
|
613
624
|
xml.RESULT {
|
614
625
|
xml.OK_ERROR 'OK'
|
615
|
-
xml.NBR_RECORD
|
626
|
+
xml.NBR_RECORD nbr_records
|
616
627
|
xml.ERROR_CODE ''
|
617
628
|
xml.MESSAGE ''
|
618
629
|
}
|
@@ -752,6 +763,7 @@ module Oddb2xml
|
|
752
763
|
prepare_limitations
|
753
764
|
prepare_articles
|
754
765
|
idx = 0
|
766
|
+
nbr_records = 0
|
755
767
|
Oddb2xml.log "build_article #{idx} of #{@articles.size} articles"
|
756
768
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
757
769
|
xml.doc.tag_suffix = @tag_suffix
|
@@ -784,7 +796,8 @@ module Oddb2xml
|
|
784
796
|
if !@infos_zur_rose.empty? && ean && @infos_zur_rose[ean]
|
785
797
|
info_zur_rose = @infos_zur_rose[ean] # zurrose
|
786
798
|
end
|
787
|
-
xml.ART('DT' => obj[:last_change] ? obj[:last_change] : '')
|
799
|
+
xml.ART('DT' => obj[:last_change] ? obj[:last_change] : '') do
|
800
|
+
nbr_records += 1
|
788
801
|
xml.REF_DATA (obj[:refdata] || @migel[pharma_code]) ? '1' : '0'
|
789
802
|
xml.PHAR sprintf('%07d', obj[:pharmacode]) if obj[:pharmacode]
|
790
803
|
#xml.GRPCD
|
@@ -948,11 +961,11 @@ module Oddb2xml
|
|
948
961
|
xml.NINCD nincd
|
949
962
|
}
|
950
963
|
end
|
951
|
-
|
964
|
+
end
|
952
965
|
end
|
953
966
|
xml.RESULT {
|
954
967
|
xml.OK_ERROR 'OK'
|
955
|
-
xml.NBR_RECORD
|
968
|
+
xml.NBR_RECORD nbr_records
|
956
969
|
xml.ERROR_CODE ''
|
957
970
|
xml.MESSAGE ''
|
958
971
|
}
|
@@ -962,6 +975,7 @@ module Oddb2xml
|
|
962
975
|
Oddb2xml.add_hash(_builder.to_xml)
|
963
976
|
end
|
964
977
|
def build_fi
|
978
|
+
nbr_records = 0
|
965
979
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
966
980
|
xml.doc.tag_suffix = @tag_suffix
|
967
981
|
datetime = Time.new.strftime('%FT%T%z')
|
@@ -985,12 +999,13 @@ module Oddb2xml
|
|
985
999
|
xml.monid info[:monid] unless info[:monid].empty?
|
986
1000
|
xml.style { xml.cdata(info[:style]) } if info[:style]
|
987
1001
|
xml.paragraph { xml.cdata(Nokogiri::HTML.fragment(info[:paragraph].to_html).to_html(:encoding => 'UTF-8')) } if info[:paragraph]
|
1002
|
+
nbr_records += 1
|
988
1003
|
}
|
989
1004
|
end
|
990
1005
|
end
|
991
1006
|
xml.RESULT {
|
992
1007
|
xml.OK_ERROR 'OK'
|
993
|
-
xml.NBR_RECORD
|
1008
|
+
xml.NBR_RECORD nbr_records
|
994
1009
|
xml.ERROR_CODE ''
|
995
1010
|
xml.MESSAGE ''
|
996
1011
|
}
|
@@ -1000,6 +1015,7 @@ module Oddb2xml
|
|
1000
1015
|
end
|
1001
1016
|
def build_fi_product
|
1002
1017
|
prepare_products
|
1018
|
+
nbr_records = 0
|
1003
1019
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
1004
1020
|
xml.doc.tag_suffix = @tag_suffix
|
1005
1021
|
datetime = Time.new.strftime('%FT%T%z')
|
@@ -1027,13 +1043,14 @@ module Oddb2xml
|
|
1027
1043
|
xml.PRDNO seq[:product_key] unless seq[:product_key].empty?
|
1028
1044
|
# as orphan ?
|
1029
1045
|
xml.DEL @orphan.include?(number) ? true : false
|
1046
|
+
nbr_records += 1
|
1030
1047
|
}
|
1031
1048
|
}
|
1032
1049
|
end
|
1033
1050
|
end
|
1034
1051
|
xml.RESULT {
|
1035
1052
|
xml.OK_ERROR 'OK'
|
1036
|
-
xml.NBR_RECORD
|
1053
|
+
xml.NBR_RECORD nbr_records
|
1037
1054
|
xml.ERROR_CODE ''
|
1038
1055
|
xml.MESSAGE ''
|
1039
1056
|
}
|
@@ -1042,6 +1059,7 @@ module Oddb2xml
|
|
1042
1059
|
Oddb2xml.add_hash(_builder.to_xml)
|
1043
1060
|
end
|
1044
1061
|
def build_company
|
1062
|
+
nbr_records = 0
|
1045
1063
|
Oddb2xml.log "build_company #{@companies.size} companies"
|
1046
1064
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
1047
1065
|
xml.doc.tag_suffix = @tag_suffix
|
@@ -1060,11 +1078,12 @@ module Oddb2xml
|
|
1060
1078
|
xml.Land c[:country] unless c[:country].empty?
|
1061
1079
|
xml.Betriebstyp c[:type] unless c[:type].empty?
|
1062
1080
|
xml.BTM_Berechtigung c[:authorization] unless c[:authorization].empty?
|
1081
|
+
nbr_records += 1
|
1063
1082
|
}
|
1064
1083
|
end
|
1065
1084
|
xml.RESULT {
|
1066
1085
|
xml.OK_ERROR 'OK'
|
1067
|
-
xml.NBR_RECORD
|
1086
|
+
xml.NBR_RECORD nbr_records
|
1068
1087
|
xml.ERROR_CODE ''
|
1069
1088
|
xml.MESSAGE ''
|
1070
1089
|
}
|
@@ -1073,6 +1092,7 @@ module Oddb2xml
|
|
1073
1092
|
Oddb2xml.add_hash(_builder.to_xml)
|
1074
1093
|
end
|
1075
1094
|
def build_person
|
1095
|
+
nbr_records = 0
|
1076
1096
|
Oddb2xml.log "build_person #{@people.size} persons"
|
1077
1097
|
_builder = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
|
1078
1098
|
xml.doc.tag_suffix = @tag_suffix
|
@@ -1090,11 +1110,12 @@ module Oddb2xml
|
|
1090
1110
|
xml.Bewilligung_Selbstdispensation p[:license] unless p[:license].empty?
|
1091
1111
|
xml.Diplom p[:certificate] unless p[:certificate].empty?
|
1092
1112
|
xml.BTM_Berechtigung p[:authorization] unless p[:authorization].empty?
|
1113
|
+
nbr_records += 1
|
1093
1114
|
}
|
1094
1115
|
end
|
1095
1116
|
xml.RESULT {
|
1096
1117
|
xml.OK_ERROR 'OK'
|
1097
|
-
xml.NBR_RECORD
|
1118
|
+
xml.NBR_RECORD nbr_records
|
1098
1119
|
xml.ERROR_CODE ''
|
1099
1120
|
xml.MESSAGE ''
|
1100
1121
|
}
|
data/lib/oddb2xml/version.rb
CHANGED
data/spec/builder_spec.rb
CHANGED
@@ -229,6 +229,14 @@ MEDIZINALPERSON_ELEMENT_TESTS = [
|
|
229
229
|
['Personen/Person/BTM_Berechtigung', 'BTM_Berechtigung'],
|
230
230
|
]
|
231
231
|
|
232
|
+
def check_result(rexml, nbr_record)
|
233
|
+
expect(XPath.match(rexml, '//RESULT/NBR_RECORD').size).to eq 1
|
234
|
+
expect(XPath.match(rexml, '//RESULT/NBR_RECORD').first.text.to_i).to eq nbr_record
|
235
|
+
expect(XPath.match(rexml, '//RESULT/OK_ERROR').first.text).to eq 'OK'
|
236
|
+
expect(XPath.match(rexml, '//RESULT/ERROR_CODE').first.text).to eq nil
|
237
|
+
expect(XPath.match(rexml, '//RESULT/MESSAGE').first.text).to eq nil
|
238
|
+
end
|
239
|
+
|
232
240
|
def checkItemForRefdata(doc, pharmacode, isRefdata)
|
233
241
|
article = XPath.match( doc, "//ART[PHAR=#{pharmacode.to_s}]").first
|
234
242
|
name = article.elements['DSCRD'].text
|
@@ -403,12 +411,13 @@ def checkArticleXml(checkERYTHROCIN = true)
|
|
403
411
|
# TODO: desitin.elements['QTY'].text.should eq '250 mg'
|
404
412
|
end
|
405
413
|
|
406
|
-
def checkProductXml
|
414
|
+
def checkProductXml(nbr_record = -1)
|
407
415
|
product_filename = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_product.xml'))
|
408
416
|
expect(File.exists?(product_filename)).to eq true
|
409
417
|
|
410
418
|
# check products
|
411
419
|
doc = REXML::Document.new IO.read(product_filename)
|
420
|
+
check_result(doc, nbr_record)
|
412
421
|
|
413
422
|
desitin = checkAndGetProductWithGTIN(doc, Oddb2xml::LEVETIRACETAM_GTIN)
|
414
423
|
expect(desitin.elements['ATC'].text).to eq('N03AX14')
|
@@ -445,8 +454,12 @@ end
|
|
445
454
|
describe Oddb2xml::Builder do
|
446
455
|
NrExtendedArticles = 90
|
447
456
|
NrSubstances = 14
|
457
|
+
NrLimitations = 5
|
458
|
+
NrInteractions = 5
|
459
|
+
NrCodes = 6
|
448
460
|
NrProdno = 23
|
449
461
|
NrPackages = 24
|
462
|
+
NrProducts = 19
|
450
463
|
RegExpDesitin = /1125819012LEVETIRACETAM DESITIN Mini Filmtab 250 mg 30 Stk/
|
451
464
|
include ServerMockHelper
|
452
465
|
def common_run_init
|
@@ -474,6 +487,10 @@ describe Oddb2xml::Builder do
|
|
474
487
|
expect(File.exists?(oddb_article_xml)).to eq true
|
475
488
|
end
|
476
489
|
|
490
|
+
it 'should have a correct NBR_RECORD in oddb_article.xml' do
|
491
|
+
check_result(@rexml, NrProducts)
|
492
|
+
end
|
493
|
+
|
477
494
|
it 'oddb_article.xml should contain a SHA256' do
|
478
495
|
expect(XPath.match(@rexml, "//ART" ).first.attributes['SHA256'].size).to eq 64
|
479
496
|
expect(XPath.match(@rexml, "//ART" ).size).to eq XPath.match(@rexml, "//ART" ).size
|
@@ -547,6 +564,16 @@ describe Oddb2xml::Builder do
|
|
547
564
|
Oddb2xml::Cli.new(options.opts).run
|
548
565
|
end
|
549
566
|
|
567
|
+
it 'should have a correct NBR_RECORD in oddb_fi_product.xml' do
|
568
|
+
rexml = REXML::Document.new File.read('oddb_fi_product.xml')
|
569
|
+
check_result(rexml, 0)
|
570
|
+
end
|
571
|
+
|
572
|
+
it 'should have a correct NBR_RECORD in oddb_fi.xml' do
|
573
|
+
rexml = REXML::Document.new File.read('oddb_fi.xml')
|
574
|
+
check_result(rexml, 2)
|
575
|
+
end
|
576
|
+
|
550
577
|
it 'should return produce a correct oddb_fi.xml' do
|
551
578
|
expect(File.exists?(@oddb_fi_xml)).to eq true
|
552
579
|
inhalt = IO.read(@oddb_fi_xml)
|
@@ -568,8 +595,9 @@ if RUN_ALL
|
|
568
595
|
|
569
596
|
it 'should generate a valid oddb_product.xml' do
|
570
597
|
expect(@res).to match(/products/) if @res
|
571
|
-
checkProductXml
|
598
|
+
checkProductXml(NrProducts)
|
572
599
|
end
|
600
|
+
|
573
601
|
end
|
574
602
|
|
575
603
|
context 'when -f dat is given' do
|
@@ -646,7 +674,7 @@ if RUN_ALL
|
|
646
674
|
|
647
675
|
it 'should generate a valid oddb_product.xml' do
|
648
676
|
expect(@res).to match(/products/) if @res != nil
|
649
|
-
checkProductXml
|
677
|
+
checkProductXml(NrProducts)
|
650
678
|
end
|
651
679
|
|
652
680
|
it 'should contain the correct (increased) prices' do
|
@@ -679,22 +707,37 @@ if RUN_ALL
|
|
679
707
|
check_elements(oddb_code_xml, CODE_ELEMENT_TESTS)
|
680
708
|
end
|
681
709
|
|
710
|
+
it 'should have a correct NBR_RECORD in oddb_code.xml' do
|
711
|
+
rexml = REXML::Document.new File.read(oddb_code_xml)
|
712
|
+
check_result(rexml, NrCodes)
|
713
|
+
end
|
714
|
+
|
682
715
|
context 'XSD interaction' do
|
683
716
|
check_attributes(oddb_interaction_xml, INTERACTION_ATTRIBUTE_TESTS)
|
684
717
|
check_elements(oddb_interaction_xml, INTERACTION_ELEMENT_TESTS)
|
685
718
|
end
|
686
719
|
|
720
|
+
it 'should have a correct NBR_RECORD in oddb_interaction.xml' do
|
721
|
+
rexml = REXML::Document.new File.read(oddb_interaction_xml)
|
722
|
+
check_result(rexml, NrInteractions)
|
723
|
+
end
|
724
|
+
|
687
725
|
context 'XSD substance' do
|
688
726
|
check_attributes(oddb_substance_xml, SUBSTANCE_ATTRIBUTE_TESTS)
|
689
727
|
check_elements(oddb_substance_xml, SUBSTANCE_ELEMENT_TESTS)
|
690
728
|
end
|
691
729
|
|
730
|
+
it 'should have a correct NBR_RECORD in oddb_substance.xml' do
|
731
|
+
rexml = REXML::Document.new File.read('oddb_substance.xml')
|
732
|
+
check_result(rexml, NrSubstances)
|
733
|
+
end
|
734
|
+
|
692
735
|
it 'should emit a correct oddb_article.xml' do
|
693
736
|
checkArticleXml
|
694
737
|
end
|
695
738
|
|
696
739
|
it 'should produce a correct oddb_product.xml' do
|
697
|
-
checkProductXml
|
740
|
+
checkProductXml(NrProducts)
|
698
741
|
end
|
699
742
|
|
700
743
|
it 'should report correct output on stdout' do
|
@@ -761,13 +804,18 @@ if RUN_ALL
|
|
761
804
|
expect(XPath.match( doc, "//PHAR" ).find_all{|x| x.text.match('0000000') }.size).to eq(1) # from refdata_pharma.xml
|
762
805
|
end
|
763
806
|
|
807
|
+
it 'should have a correct NBR_RECORD in oddb_limitation.xml' do
|
808
|
+
rexml = REXML::Document.new File.read('oddb_limitation.xml')
|
809
|
+
check_result(rexml, NrLimitations)
|
810
|
+
end
|
811
|
+
|
764
812
|
it 'should emit a correct oddb_limitation.xml' do
|
765
813
|
# check limitations
|
766
814
|
limitation_filename = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_limitation.xml'))
|
767
815
|
expect(File.exists?(limitation_filename)).to eq true
|
768
816
|
doc = REXML::Document.new File.new(limitation_filename)
|
769
817
|
limitations = XPath.match( doc, "//LIM" )
|
770
|
-
expect(limitations.size).to
|
818
|
+
expect(limitations.size).to eql NrLimitations
|
771
819
|
expect(XPath.match( doc, "//SwissmedicNo5" ).find_all{|x| x.text.match('28486') }.size).to eq(1)
|
772
820
|
expect(XPath.match( doc, "//LIMNAMEBAG" ).find_all{|x| x.text.match('ZYVOXID') }.size).to eq(1)
|
773
821
|
expect(XPath.match( doc, "//LIMNAMEBAG" ).find_all{|x| x.text.match('070240') }.size).to eq(1)
|
@@ -823,13 +871,13 @@ if RUN_ALL
|
|
823
871
|
it 'should add 80 percent to zur_rose pubbprice' do
|
824
872
|
expect(File.exists?(oddb_article_xml)).to eq true
|
825
873
|
FileUtils.cp(oddb_article_xml, File.join(Oddb2xml::WorkDir, 'tst-e80.xml'))
|
826
|
-
checkProductXml
|
874
|
+
checkProductXml(NrProducts)
|
827
875
|
checkArticleXml
|
828
876
|
checkPrices(true)
|
829
877
|
end
|
830
878
|
|
831
879
|
it 'should generate a correct oddb_product.xml' do
|
832
|
-
checkProductXml
|
880
|
+
checkProductXml(NrProducts)
|
833
881
|
end
|
834
882
|
|
835
883
|
it 'should generate an article with the COOL (fridge) attribute' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|