json_api_client
json_api_client copied to clipboard
Allow custom_enpoint method and route to be different
Scenario:
I have to custom_endpoints with the same name. One for PUT and one for DELETE
I cannot fint a way to use custom_endpoints for this, because custom_endpoints sets the path/route and method to the same.
custom_endpoint :cancellation, on: :member, request_method: :put
custom_endpoint :cancellation, on: :member, request_method: :delete
calling MyObject.cancellation will result in a delte request and I have not found a way of calling the put request. There should be another param to differ between path and method name
custom_endpoint :cancel, path: :cancellation, request_method: :put
custom_endpoint :reactivate, path: :cancellation, request_method: :put
allowing MyObject.cancel and MyObject.reactivate using the correct path and request_method.
+1
In my case I would like to create the method apply but the path to be /actions/apply