lib/raterr.rb in raterr-0.1.1 vs lib/raterr.rb in raterr-0.1.2
- old
+ new
@@ -1,12 +1,13 @@
-require 'active_support'
require 'raterr/version'
+require 'raterr/store_container'
require 'raterr/period_builder'
require 'raterr/mixin'
require 'raterr/hour'
require 'raterr/day'
require 'raterr/minute'
+require 'redis'
module Raterr
InvalidStore = Class.new(StandardError)
@@ -21,10 +22,10 @@
class << self
attr_accessor :store
def enforce(request, **options)
- unless store.is_a?(Hash) || store.is_a?(::ActiveSupport::Cache::MemoryStore)
+ unless store.is_a?(Hash) || store.is_a?(::Redis)
raise InvalidStore.new('Store is not valid, please refer to the documentation')
end
period = PeriodBuilder.call(request, options)
period.allowed? ? period.proceed : period.rate_limit_exceeded