Class: Notion::Middleware::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/notion/middleware/stack.rb

Class Method Summary collapse

Class Method Details

.build(adapter, config) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/notion/middleware/stack.rb', line 6

def self.build(adapter, config)
  app = JsonCodec.new(adapter)
  app = Compatibility.new(app, config)
  app = ApiVersion.new(app, config)
  app = Authentication.new(app, config)
  key = config.token || (config.token_store && [config.token_store.object_id, config.token_key])
  store = config.rate_limit_store || RateLimiter::DEFAULT_STORE
  app = RateLimiter.new(app, rate: config.rate, burst: config.burst, key: key, store: store)
  app = Retry.new(app, max_attempts: config.max_attempts, cap: config.retry_cap)
  app = Logging.new(app, logger: config.logger, level: config.log_level)
  Instrumentation.new(app)
end