oddb2xml 2.3.8 → 2.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0df0b68570a06023f0f84f78759eba514f5a4b2
4
- data.tar.gz: 484b181df37c6813c3c62ea6feeb429dee57aa55
3
+ metadata.gz: 6fca3e8cb403c6b1018420e04b9b1cbcb75c38ba
4
+ data.tar.gz: c7dd0da5fee78db1d4455f8e3b3cc85509fecfbb
5
5
  SHA512:
6
- metadata.gz: c79037072f934cba4a8910756dacf0984dd62d4f059572b50346ab3d0475377452e9c5cafb14f8961b9a88706c9a66d42ff44ef720af16d5d2ce8c7d1f7cb844
7
- data.tar.gz: 6f444c348ee935c90d54331ebcdd8736354e00ca9e7aebc5adea2e81f8733c39db1e275001539139d8f03442c57ad75d49009e649903040a00f70275589faeea
6
+ metadata.gz: cacc0a90106da5da0ef3fe85ddde95947aac9a023095b5eed345e4d6c1cd2a88cb55020b9d9fd390f94e17d548265766e73255d3a2e9a342bc61ba578eb1e572
7
+ data.tar.gz: 4e2ef6fec5b3b7f1544ce1fb7d5322e99ba3af217189388523f2891521818ae5d21cc3516d823254e4d5f517059cd5916ac478a885fdb16dae3d368dc9b85a4d
data/.travis.yml CHANGED
@@ -15,6 +15,7 @@ rvm:
15
15
  - 2.0.0
16
16
  - 2.1
17
17
  - 2.2
18
+ - 2.3.1
18
19
  - ruby-head
19
20
 
20
21
  matrix:
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.3.9 /23.08.2016
2
+
3
+ * Get ZurRose data from http://pillbox.oddb.org/TRANSFER.ZIP
4
+
1
5
  === 2.3.8 /19.04.2016
2
6
 
3
7
  * DSCRD/DSCRD for article/product must be between 3 and 120 chars long
@@ -145,15 +145,29 @@ module Oddb2xml
145
145
  class ZurroseDownloader < Downloader
146
146
  include DownloadMethod
147
147
  def download
148
- @url ||= 'http://zurrose.com/fileadmin/main/lib/download.php?file=/fileadmin/user_upload/downloads/ProduktUpdate/IGM11_mit_MwSt/Vollstamm/transfer.dat'
148
+ @url ||= 'http://pillbox.oddb.org/TRANSFER.ZIP'
149
149
  unless @url =~ /^http/
150
150
  io = File.open(@url, 'r:iso-8859-1:utf-8')
151
151
  content = io.read
152
152
  Oddb2xml.log("ZurroseDownloader #{__LINE__} download #{@url} @url returns #{content.bytes}")
153
- content
153
+ content
154
154
  else
155
- Oddb2xml.log("ZurroseDownloader #{__LINE__} download #{@url} @url")
156
- download_as('zurrose_transfer.dat', 'r:iso-8859-1:utf-8')
155
+ file = File.join(WorkDir, 'transfer.zip')
156
+ unless Oddb2xml.skip_download(file)
157
+ Oddb2xml.log "ZurroseDownloader #{__LINE__}: #{file}"
158
+ begin
159
+ response = @agent.get(@url)
160
+ response.save_as(file)
161
+ response = nil # win
162
+ rescue Timeout::Error, Errno::ETIMEDOUT
163
+ retrievable? ? retry : raise
164
+ ensure
165
+ Oddb2xml.download_finished(file)
166
+ end
167
+ end
168
+ read_xml_from_zip(/transfer.dat/, File.join(Downloads, File.basename(file)))
169
+ dest = File.join(Downloads, 'transfer.dat')
170
+ File.open(dest, 'r:iso-8859-1:utf-8').read
157
171
  end
158
172
  end
159
173
  end
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.3.8"
2
+ VERSION = "2.3.9"
3
3
  end
data/spec/builder_spec.rb CHANGED
@@ -608,7 +608,7 @@ if RUN_ALL
608
608
  # Oddb2xml::Cli.new(options.opts).run # to debug
609
609
  end
610
610
 
611
- it 'should contain the correct values fo CMUT from zurrose_transfer.dat' do
611
+ it 'should contain the correct values fo CMUT from transfer.dat' do
612
612
  expect(@res).to match(/products/)
613
613
  dat_filename = File.join(Oddb2xml::WorkDir, 'oddb.dat')
614
614
  expect(File.exists?(dat_filename)).to eq true
@@ -911,7 +911,7 @@ if RUN_ALL
911
911
  expect(@res).to match(/products/)
912
912
  end
913
913
 
914
- it 'should contain the correct values fo CMUT from zurrose_transfer.dat' do
914
+ it 'should contain the correct values fo CMUT from transfer.dat' do
915
915
  dat_filename = File.join(Oddb2xml::WorkDir, 'oddb.dat')
916
916
  expect(File.exists?(dat_filename)).to eq true
917
917
  oddb_dat = IO.read(dat_filename)
data/spec/cli_spec.rb CHANGED
@@ -183,7 +183,7 @@ describe Oddb2xml::Cli do
183
183
  expect(@cli_output).to match(/\sPharma\s/)
184
184
  expected = [
185
185
  'duplicate_ean13_from_zur_rose.txt',
186
- 'zurrose_transfer.dat',
186
+ 'transfer.zip',
187
187
  'oddb.dat',
188
188
  ].each{ |file|
189
189
  expect(File.exists?(File.join(Oddb2xml::WorkDir, file))).to eq true
File without changes
@@ -461,6 +461,7 @@ describe Oddb2xml::ZurroseDownloader do
461
461
  end
462
462
  it 'should clean up current directory' do
463
463
  expect { dat }.not_to raise_error
464
+ expect(File.exist?('transfer.dat')).to eq(false)
464
465
  expect(File.exist?('oddb2xml_zurrose_transfer.dat')).to eq(false)
465
466
  end
466
467
  end
@@ -331,7 +331,7 @@ describe Oddb2xml::ZurroseExtractor do
331
331
  end
332
332
  context 'when parsing examples' do
333
333
  subject do
334
- filename = File.expand_path(File.join(__FILE__, '..', 'data', 'zurrose_transfer.dat'))
334
+ filename = File.expand_path(File.join(__FILE__, '..', 'data', 'transfer.dat'))
335
335
  Oddb2xml::ZurroseExtractor.new(filename, true)
336
336
  end
337
337