I was curious when building a method to call an endpoint using the Net::HTTP library in rails. As the endpoint I was calling accepted the same body but with multiple request methods, I wanted to dynamically call Net::HTTP.
To do this, I used this concoction
req_method = Object.const_get "Net::HTTP::#{method.capitalize}"
But feel this is ugly and not elegant. Is there a more rails or just a cleaner way to call that method in a dynamic way?