Closed sebasjimenez10 closed 6 months ago
Hey @gaorlov 👋 giving this one a bump for you to take a look 🙏
What's the current blocker for merging this one? 🙏
Hello! Thanks for taking the time to contribute! I'll take a closer look tomorrow. I'm the meantime, can you please add an entry to the changelog?
Thanks!
Greg
@gaorlov updated the changelog! 🙏
@gaorlov small bump! 🙂
@sebasjimenez10 sorry about the delay. For reasons i don't yet understand the automated testing has stopped working. I'm working with the owners of the JsonAPiClient
org to resolve this issue and will let you know when we can start merging again.
I appreciate your patience!
Greg
@gaorlov thank you so much for looking into it. No worries on the wait, I'm glad to contribute 🙏🏻
Hey @gaorlov, just dropping by and giving this one a bump! 🙏
Hey @gaorlov, hope you're doing good! Just wanted to bump this one!
🙏
@gaorlov done! Just rebased on top of master
(main). Tests are looking good. Please let me know if there is anything else I need to do!
@gaorlov small bump!
@gaorlov tiny bump on this one! 🙏
This PR fixes an issue I experienced when working with multi-word custom endpoints. If you have a multi-word custom endpoint and you also have the
self.route_format = :dasherized_route
config in your base class, upon calling thatcustom_endpoint
JsonApiClient doesn't respect the configuration selected and will use the underscored version of the endpoint name.For instance:
Given,
When calling
Pet.vip_pets
orpet = Pet.new(...); pet.related_pets
the resulting endpoint being called will be either:http://example.com/pets/vip_pets
orhttp://example.com/pets/:id/related_pets
instead of
http://example.com/pets/vip-pets
orhttp://example.com/pets/:id/related-pets
Same issue applies for
camelized_routes
.This PR fixes this by checking the
route_format
configuration attribute and making sure it is converted to the appropriate endpoint name, usingActiveSupport
helper methods.The methods defined in the instance of the class will still be underscored, so that we can still do
Pet.vip_vets
.Happy to address any concerns or comments, thanks!