Class: Oddb2xml::MedregbmDownloader
- Inherits:
-
Downloader
- Object
- Downloader
- Oddb2xml::MedregbmDownloader
- Includes:
- DownloadMethod
- Defined in:
- lib/oddb2xml/downloader.rb
Instance Attribute Summary
Attributes inherited from Downloader
#agent, #file2save, #type, #url
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(type = :company) ⇒ MedregbmDownloader
constructor
A new instance of MedregbmDownloader.
Methods inherited from Downloader
Constructor Details
#initialize(type = :company) ⇒ MedregbmDownloader
Returns a new instance of MedregbmDownloader.
223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/oddb2xml/downloader.rb', line 223 def initialize(type = :company) @type = type action = case @type when :company # betrieb "CreateExcelListBetriebs" when :person # medizinalperson "CreateExcelListMedizinalPersons" else "" end url = "https://www.medregbm.admin.ch/Publikation/#{action}" super({}, url) end |
Instance Method Details
#download ⇒ Object
237 238 239 240 241 242 243 |
# File 'lib/oddb2xml/downloader.rb', line 237 def download file = "medregbm_#{@type}.txt" download_as(file, "w+:iso-8859-1:utf-8") report_download(@url, file) FileUtils.rm_f(file, verbose: true) # we need it only in the download file end |