Class: GeneratorLabs::RateLimitInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/generatorlabs/rate_limit_info.rb

Overview

Rate limit information from API response headers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit:, remaining:, reset:) ⇒ RateLimitInfo

Returns a new instance of RateLimitInfo.



24
25
26
27
28
# File 'lib/generatorlabs/rate_limit_info.rb', line 24

def initialize(limit:, remaining:, reset:)
  @limit = limit
  @remaining = remaining
  @reset = reset
end

Instance Attribute Details

#limitString (readonly)

Returns Active rate limit policies, e.g. “1000;w=3600, 100;w=1”.

Returns:

  • (String)

    Active rate limit policies, e.g. “1000;w=3600, 100;w=1”



16
17
18
# File 'lib/generatorlabs/rate_limit_info.rb', line 16

def limit
  @limit
end

#remainingInteger (readonly)

Returns Requests remaining in the most restrictive active window.

Returns:

  • (Integer)

    Requests remaining in the most restrictive active window



19
20
21
# File 'lib/generatorlabs/rate_limit_info.rb', line 19

def remaining
  @remaining
end

#resetInteger (readonly)

Returns Seconds until the most restrictive window resets.

Returns:

  • (Integer)

    Seconds until the most restrictive window resets



22
23
24
# File 'lib/generatorlabs/rate_limit_info.rb', line 22

def reset
  @reset
end