I'm using the helpscout
ruby gem and trying to check when request limit is under a certain number (i.e 2 requests remaining) and sleep the loop for the remaining interval to allow for rate limit to be reset.
Is there a way to access the response headers from an API when making a request? https://developer.helpscout.com/help-desk-api/#basic-rate-limiting
X-RateLimit-Interval-* Length of the rate limiting interval in seconds
X-RateLimit-Limit-* Maximum number of requests per interval
X-RateLimit-Remaining-* Number of requests remaining in the current rate limit interval
Intercom (https://developers.intercom.com/reference#rate-limiting) allows your to check the rate_limit_details and returns the headers, but I can't find anything for Help Scout or understand how to access them.
intercom.rate_limit_details
#=> {:limit=>180, :remaining=>179, :reset_at=>2014-10-07 14:58:00 +0100}