Class: Kamome::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/kamome/downloader.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Downloader



11
12
13
# File 'lib/kamome/downloader.rb', line 11

def initialize(config)
  @config = config
end

Instance Method Details

#run(url:) ⇒ Pathname



16
17
18
19
20
21
22
23
# File 'lib/kamome/downloader.rb', line 16

def run(url:)
  zip_path = download(url)
  csv_path = unpack(zip_path)
  zip_path.delete
  csv_path
rescue StandardError => e
  raise Kamome::DownloadError, "#{url}, #{e.class}: #{e.message}"
end