class Vindi::Middleware::RateLimitValidation
Saves the rate limts from Vindi
responses.
Public Instance Methods
call(env)
click to toggle source
# File lib/vindi/middleware/rate_limit_validation.rb, line 7 def call(env) raise Vindi::RateLimitError, "Rate limit reached" if rate_limit_reached? @app.call(env) end
Private Instance Methods
rate_limit_reached?()
click to toggle source
# File lib/vindi/middleware/rate_limit_validation.rb, line 15 def rate_limit_reached? return false unless Vindi::RateLimit.rate_limit_limit Vindi::RateLimit.rate_limit_limit <= Vindi::RateLimit.rate_limit_remaining && Vindi::RateLimit.rate_limit_reset > Time.now end