oddb2xml 2.3.8 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/History.txt +4 -0
- data/lib/oddb2xml/downloader.rb +18 -4
- data/lib/oddb2xml/version.rb +1 -1
- data/spec/builder_spec.rb +2 -2
- data/spec/cli_spec.rb +1 -1
- data/spec/data/{zurrose_transfer.dat → transfer.dat} +0 -0
- data/spec/downloader_spec.rb +1 -0
- data/spec/extractor_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/oddb2xml.json +21 -16
- data/spec/spec_helper.rb +1 -1
- metadata +4 -5
- data/Gemfile.lock +0 -141
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fca3e8cb403c6b1018420e04b9b1cbcb75c38ba
|
4
|
+
data.tar.gz: c7dd0da5fee78db1d4455f8e3b3cc85509fecfbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cacc0a90106da5da0ef3fe85ddde95947aac9a023095b5eed345e4d6c1cd2a88cb55020b9d9fd390f94e17d548265766e73255d3a2e9a342bc61ba578eb1e572
|
7
|
+
data.tar.gz: 4e2ef6fec5b3b7f1544ce1fb7d5322e99ba3af217189388523f2891521818ae5d21cc3516d823254e4d5f517059cd5916ac478a885fdb16dae3d368dc9b85a4d
|
data/.travis.yml
CHANGED
data/History.txt
CHANGED
data/lib/oddb2xml/downloader.rb
CHANGED
@@ -145,15 +145,29 @@ module Oddb2xml
|
|
145
145
|
class ZurroseDownloader < Downloader
|
146
146
|
include DownloadMethod
|
147
147
|
def download
|
148
|
-
@url ||= 'http://
|
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
|
-
|
156
|
-
|
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
|
data/lib/oddb2xml/version.rb
CHANGED
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
|
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
|
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
|
-
'
|
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
|
data/spec/downloader_spec.rb
CHANGED
@@ -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
|
data/spec/extractor_spec.rb
CHANGED
@@ -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', '
|
334
|
+
filename = File.expand_path(File.join(__FILE__, '..', 'data', 'transfer.dat'))
|
335
335
|
Oddb2xml::ZurroseExtractor.new(filename, true)
|
336
336
|
end
|
337
337
|
|