class Multiwoven::Integrations::Destination::Sftp::Client
def write(sync_config, records, _action = "destination_insert")
def write(sync_config, records, _action = "destination_insert") @sync_config = sync_config connection_config = sync_config.destination.connection_specification.with_indifferent_access file_path = generate_file_path(sync_config) local_file_name = generate_local_file_name(sync_config) csv_content = generate_csv_content(records) records_size = records.size write_success = 0 case connection_config[:format][:compression_type] when CompressionType.enum("zip") write_success = write_compressed_data(connection_config, file_path, local_file_name, csv_content, records_size) when CompressionType.enum("un_compressed") write_success = write_uncompressed_data(connection_config, file_path, local_file_name, csv_content, records_size) else raise ArgumentError, "Unsupported compression type: #{connection_config[:format][:compression_type]}" end write_failure = records.size - write_success tracking_message(write_success, write_failure) rescue StandardError => e handle_exception(e, { context: "SFTP:WRITE:EXCEPTION", type: "error", sync_id: @sync_config.sync_id, sync_run_id: @sync_config.sync_run_id }) end