In an effort to learn more about Ruby and APIs I came up with the idea of an API that dynamically adds routes to itself, and will respond with a payload that is specified by the user. The use case for this that I thought of was in the event you are going to interact with a 3rd party API, you would be able to build a quick request/response mockup to test against without actually hitting the 3rd party. You can create invalid responses to test your error handling, or mess with the data, whatever your heart desires.
The current iteration consumes a JSON payload with up to three keys:
You will receive a response similar to:
You can then update the route using the key provided.
I only currently respond with a string. The idea is to be able to consume an entire JSON response as well as allowing a POST with a response. It’s almost entirely useless right now.