class Multiwoven::Integrations::Destination::Sftp::Client
def write_compressed_data(connection_config, file_path, local_file_name, csv_content, records_size)
def write_compressed_data(connection_config, file_path, local_file_name, csv_content, records_size) write_success = 0 Tempfile.create([local_file_name, ".zip"]) do |tempfile| Zip::File.open(tempfile.path, Zip::File::CREATE) do |zipfile| zipfile.get_output_stream("#{local_file_name}.csv") { |f| f.write(csv_content) } end with_sftp_client(connection_config) do |sftp| sftp.upload!(tempfile.path, file_path) write_success = records_size rescue StandardError => e # TODO: add sync_id and sync_run_id to the log handle_exception(e, { context: "SFTP:RECORD:WRITE:EXCEPTION", type: "error", sync_id: @sync_config.sync_id, sync_run_id: @sync_config.sync_run_id }) write_success = 0 end end write_success end