estately / rets

A pure-ruby library for fetching data from RETS servers
https://github.com/estately/rets
127 stars 94 forks source link

State of login_url was causing unecessary URI::InvalidError #215

Closed bastosmichael closed 5 years ago

bastosmichael commented 6 years ago

I've included your gem in a private gem and would need this implemented and pushed out to Rubygems or I'd have a nightmare of a time using my own repo if you guys can include it and push up a patch I'd appreciate it. Thanks

bspatafora commented 5 years ago

Hey Michael, very sorry for the way-too-long delay in getting back to you. We'd like to avoid making this change because it would mean the library "fails slow" when login_url is nil.

URI.parse(nil) blows up immediately with URI::InvalidURIError: bad URI(is not URI?), whereas URI.parse(nil.to_s) succeeds in creating a URI object, meaning that the inevitable failure won't occur until some point further from the source of the problem (passing a nil login_url to the client).

It sounds like you're passing a URI object as the value for login_url when initializing the client. Avoiding this issue should be as simple as calling to_s on that URI on your end, but let me know if I'm missing something.