I am implementing a REST client in Ruby and am treating base URLs as instances of URI. For the path after the base URL, I am unsure whether to treat it also as a URI instance or as a string.
Approach A
base_url = URI("http://www.foo.com")
path = URI("/someaction")
Approach B
base_url = URI("http://www.foo.com")
path = "/someaction"
With both of the above approaches, I plan to call URI.join(base_url, path) before making my request. Which of the approaches would be considered a better practice?