Class: Crunchbase::Downloads::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/crunchbase/downloads/client.rb

Overview

using Crunchbase’s downloads API endpoints

Instance Method Summary collapse

Instance Method Details

#download_bulk(dir, extract: false) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/crunchbase/downloads/client.rb', line 14

def download_bulk(dir, extract: false)
  FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
  dist_path = Pathname.new(dir).join File.basename(bulk_url)

  download(bulk_url, dist_path) unless File.exist?(dist_path)
  system "tar xfz #{dist_path} -C #{dir}" if extract

  dist_path
end