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

Handle API rate limit responses with RateLimitExceeded exception #146

Closed watsonian closed 5 years ago

watsonian commented 9 years ago

This adds a new RateLimitExceeded exception when a 403 response code is encountered as described in the docs. I've been hitting this in an on-prem installation and it would be nice to be able to rescue this error. Having some way to fetch the current rate limit values via the Ruby client would be nice too, but that's outside the scope of this PR, I think.

I believe I got all the places where this needed to go and updated the tests accordingly, but would love a once-over by someone more familiar with the code.