yuki24 / artemis

Ruby GraphQL client on Rails that actually makes you more productive
MIT License
207 stars 14 forks source link

Attempt at extending callbacks to include before request / after request #59

Closed JanStevens closed 4 months ago

JanStevens commented 5 years ago

From the ongoing discussion in #57 I took a small stab at it:

I didn't really find a better way to pass the callbacks to the adapters, this renders the Executor a bit useless. I think the code can be refactored a bit more (especially the adapter part) so execute is not that big of a method.

Didn't add specs yet, lets first see if this POC is in the right direction

JanStevens commented 5 years ago

Thanks for you input, when coding this I did felt the same. I'm quite happy now with my own adapter implementation that is used in production.

Should I persuade this merge request or leave it for now?

JanStevens commented 5 years ago

I put my custom adapter in a gem: https://github.com/JanStevens/artemis-api-auth/tree/master

Indeed not that hard to add it, probably a better way to register new adapters would be handy

yuki24 commented 5 years ago

Thanks for all the contributions you've made @JanStevens! I'll add your adapter to README. I also wasn't aware of the fact that the HMAC authentication could be abstracted the way the api_auth does - it might be worthwhile adding built-in support for that if that's common.

Let's also leave this issue open. I think this PR has good amount of context that others can look at and a generic request interceptor may be helpful for other things in the future. Thanks again for all the work you've done!