Save 36% for Black Friday! Learn more

Michael

Joined

360 Experience
3 Lessons Completed
0 Questions Solved

Activity

Posted in 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!

In case of a has_many_attached setup, how would you go about creating a link to delete an individual file? 
logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.