Should we raise an error when passing an invalid api version?
v9n opened this issue · comments
I'm a newbie Ruby and today I had a hard time debugging when passing an invalid api version, I pass 2
instead of v2
to HipChat::Client.new
and I ended with this error message:
NoMethodError: undefined method `[]' for nil:NilClass
from /Users/kureikain/.rvm/gems/ruby-2.2.2/gems/hipchat-1.5.1/lib/hipchat/room.rb:21:in `get_room'
Because of this https://github.com/hipchat/hipchat-rb/blob/master/lib/hipchat/api_version.rb#L96
So I think we should raise an exception when passing an invalid api version to prevent any confusion, probably in https://github.com/hipchat/hipchat-rb/blob/master/lib/hipchat/client.rb#L12
Yes, that would be useful, would you mind filing a PR for this? I'll leave the issue open, in case someone else wants to take a shot at it.
#139 fixes this, thanks!