Hi David, I like your approach of have separate classes for success and failure responses. Besides that both works the same way (have #success? and #failure? methods and data attached to them, like errors or error_messages for example), it seems better as you said to have a specialized class to which we can have enough confidence to know that they will respond the way they are supposed to.

At the end, the important thing is to be able to interact in a better and predictable way within our application layers.


Written by

Frontend Developer 👨‍💻 Follow me on Twitter 🐦 https://twitter.com/giovannibenussi

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store