hipchat / hipchat-rb

HipChat HTTP API Wrapper in Ruby with Capistrano hooks
https://www.hipchat.com/docs/apiv2
MIT License
336 stars 172 forks source link

In HipChat::Client, initialize @api_version with default options #130

Closed mhink closed 9 years ago

mhink commented 9 years ago

...if options[:api_version] is unset.

coveralls commented 9 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling af31d2ce1b8105a53af00f5a65ac26a1363b3f06 on mhink:master into 137f8aa47b5ebfb9306ab9defc607cf983b6fbdc on hipchat:master.

coveralls commented 9 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling af31d2ce1b8105a53af00f5a65ac26a1363b3f06 on mhink:master into 137f8aa47b5ebfb9306ab9defc607cf983b6fbdc on hipchat:master.

baburdick commented 9 years ago

I haven't tested this locally. But the changes stand to reason. Looks good to me.

baburdick commented 9 years ago

One note: there should be a test that would catch this issue.

uxp commented 9 years ago

This bug just caught me. Simply running an example message send would result in failure.

irb(main)> client = HipChat::Client.new "my_token..."
irb(main)> client['Room'].send("Service", "Heyo!")
NoMethodError: undefined method `[]' for nil:NilClass
        from /usr/local/rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/hipchat-1.5.0/lib/hipchat/room.rb:122:in `send'
        from (irb):2

But, adding the api version explicitly would succeed.

client = HipChat::Client.new "my_token...", api_version: 'v2'