Skip to content

Commit

Permalink
Adapt to new location of epha interaction.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Apr 30, 2014
1 parent 69c4d85 commit f70c117
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions lib/oddb2xml/downloader.rb
Expand Up @@ -99,7 +99,7 @@ def download
class EphaDownloader < Downloader
include DownloadMethod
def download
@url ||= 'http://community.epha.ch/interactions_de_utf8.csv'
@url ||= 'https://download.epha.ch/cleaned/matrix.csv'
download_as('epha_interactions.csv', 'r')
end
end
Expand Down Expand Up @@ -165,7 +165,14 @@ def download
response = nil # win
end
end
read_xml_form_zip(/^Preparation/iu, file)
inhalt = read_xml_form_zip(/^Preparation/iu, file)
if @options[:skip_download]
FileUtils.makedirs(Backup)
outfile = File.join(Backup, 'Preparations.xml')
Oddb2xml.log "Downloader saving outfile #{outfile} for #{self.class}"
File.open(outfile, 'w+') { |file| file.write inhalt}
end
inhalt
rescue Timeout::Error, Errno::ETIMEDOUT
retrievable? ? retry : raise
ensure
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Expand Up @@ -156,12 +156,12 @@ def setup_swissmedic_info_server_mock
end
def setup_epha_server_mock
# csv
stub_csv_url = 'http://community.epha.ch/interactions_de_utf8.csv'
stub_csv_url = 'https://download.epha.ch/cleaned/matrix.csv'
stub_response = File.read(File.expand_path('../data/epha_interactions.csv', __FILE__))
stub_request(:get, stub_csv_url).
with(:headers => {
'Accept' => '*/*',
'Host' => 'community.epha.ch',
'Host' => 'download.epha.ch',
}).
to_return(
:status => 200,
Expand Down

0 comments on commit f70c117

Please sign in to comment.