Sha256: a93caeaf0625b5a5873784e6a213a0d8e7c03b92d839a2aed9f7664d29f1489b
Contents?: true
Size: 664 Bytes
Versions: 4
Compression:
Stored size: 664 Bytes
Contents
require "memoizable" module Twitter class RateLimit < Twitter::Base include Memoizable # @return [Integer] def limit limit = @attrs["x-rate-limit-limit"] limit&.to_i end memoize :limit # @return [Integer] def remaining remaining = @attrs["x-rate-limit-remaining"] remaining&.to_i end memoize :remaining # @return [Time] def reset_at reset = @attrs["x-rate-limit-reset"] Time.at(reset.to_i).utc if reset end memoize :reset_at # @return [Integer] def reset_in [(reset_at - Time.now).ceil, 0].max if reset_at end alias retry_after reset_in end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
twitter-8.1.0 | lib/twitter/rate_limit.rb |
twitter-8.0.1 | lib/twitter/rate_limit.rb |
twitter-8.0.0 | lib/twitter/rate_limit.rb |
twitter-8.0.0.rc.1 | lib/twitter/rate_limit.rb |