Sha256: 1efeeb1393e374fe88db8b245594d7b17538c5e8ad2bd465d2964ecb2646cd34

Contents?: true

Size: 436 Bytes

Versions: 2

Compression:

Stored size: 436 Bytes

Contents

class AplApiConfig
  include ApiCache

  def initialize(app)
    @app = app
  end

  def call(env)
    bu = Thread.current[:apl_bu]
    method = env['REQUEST_METHOD']
    uri = env['REQUEST_URI']

    logger.info "Params in rack - #{bu}, #{method}, #{uri}"
    disabled = check_api_disabled bu, method, uri
    return [503, {'Content-Type' => 'text/plain'}, ['Api is temporarily unavailable']] if disabled
    @app.call(env)
  end

end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
apl-library-0.0.90 lib/apl-library/rack/apl_api_config.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/lib/apl-library/rack/apl_api_config.rb