Handle "delayed" response from external API
I have been following the series on building a gem using Faraday against the Vultr API and have started building my own version of it against one of the Azure dataplane API's. This works a little bit differently, in the sense that for every action (create, update and delete) you get an immediate response with an operationId, which you then have to poll, to get the status of the operation ("in progress", "succeded", "failed" etc.), and if it failed, you will also get the error message.
I have never tried to work with such a scenario before, so I would appreciate some input on how you would handle this. I imagine that in the application, where the gem will eventually end up being used, the form for creating a ressource, only returns once the status is "succeded" / "failed".
In short, how should I approach this? Should it be handled in the gem or the application? And how?
I really appreciate any input on this - thanks!