Class: AdLocalize::Interactors::DownloadSpreadsheets

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

Instance Method Summary collapse

Constructor Details

#initializeDownloadSpreadsheets

Returns a new instance of DownloadSpreadsheets.



5
6
7
# File 'lib/ad_localize/interactors/download_spreadsheets.rb', line 5

def initialize
  @drive_repository = Repositories::DriveRepository.new
end

Instance Method Details

#call(export_request:) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ad_localize/interactors/download_spreadsheets.rb', line 9

def call(export_request:)
  LOGGER.debug("Downloading spreadsheets")
  if export_request.export_all
    @drive_repository.download_all_sheets(spreadsheet_id: export_request.spreadsheet_id)
  else
    @drive_repository.download_sheets_by_id(spreadsheet_id: export_request.spreadsheet_id,
                                            sheet_ids: export_request.sheet_ids)
  end
end