I am getting 502 error while trying to delete topics created by specific user

@ Michael Brown @southpaw I have created a plugin to delete posts of a user in batches of a given number. I have written some Ruby code to delete posts. Currently I am using settings api to take input from admin.

The challenge I am facing is that. I want to create a admin page for plugin that has a some input fields and a button. I want my Ruby code to run on click of that button.

I have tried someways but failed.

Need help, Is there any possible way to achieve it in discourse?