Class: AdLocalize::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/ad_localize/cli.rb

Class Method Summary collapse

Class Method Details

.start(args:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ad_localize/cli.rb', line 4

def self.start(args:)
  options = OptionHandler.parse!(args)
  export_request = Mappers::OptionsToExportRequest.new.map(options: options)
  LOGGER.debug("Export request options : #{export_request}")
  export_request.downloaded_csvs = Interactors::DownloadSpreadsheets.new.call(export_request: export_request) if export_request.has_sheets?
  Interactors::ProcessExportRequest.new.call(export_request: export_request)
ensure
  export_request&.downloaded_csvs&.each do |file|
    file.close
    file.unlink
  end
end