class FaradayMiddleware::CircuitBreaker::OptionSet
Constants
- VALID_OPTIONS
Attributes
data_store[RW]
error_handler[RW]
fallback[RW]
notifiers[RW]
threshold[RW]
timeout[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/faraday_middleware/circuit_breaker/option_set.rb, line 13 def initialize(options = {}) @timeout = options[:timeout] || 60.0 @threshold = options[:threshold] || 3 @fallback = options[:fallback] || proc { Faraday::Response.new(status: 503, response_headers: {}) } @notifiers = options[:notifiers] || {} @data_store = options[:data_store] || proc { Stoplight::Light.default_data_store } @error_handler = options[:error_handler] || Stoplight::Default::ERROR_HANDLER end
validate!(options)
click to toggle source
# File lib/faraday_middleware/circuit_breaker/option_set.rb, line 22 def self.validate!(options) options.each_key do |key| unless VALID_OPTIONS.include?(key.to_s) fail ArgumentError.new("Unknown option: #{key}. Valid options are :#{VALID_OPTIONS.join(', ')}") end end end