Class: PactBroker::App
- Inherits:
-
Object
- Object
- PactBroker::App
- Defined in:
- lib/pact_broker/app.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize {|configuration| ... } ⇒ App
constructor
A new instance of App.
-
#use(*args, &block) ⇒ Object
Allows middleware to be inserted at the bottom of the shared middlware stack (ie just before the cascade is called for diagnostic, UI and API).
-
#use_api_auth(middleware) ⇒ Object
private API, not sure if this will continue to be supported.
-
#use_ui_auth(middleware) ⇒ Object
private API, not sure if this will continue to be supported.
Constructor Details
#initialize {|configuration| ... } ⇒ App
Returns a new instance of App.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pact_broker/app.rb', line 23 def initialize &block @app_builder = ::Rack::Builder.new @cascade_apps = [] @make_it_later_api_auth = ::Rack::PactBroker::ConfigurableMakeItLater.new(Rack::PactBroker::NoAuth) @make_it_later_ui_auth = ::Rack::PactBroker::ConfigurableMakeItLater.new(Rack::PactBroker::NoAuth) @configuration = PactBroker.configuration yield configuration post_configure prepare_database prepare_app end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
21 22 23 |
# File 'lib/pact_broker/app.rb', line 21 def configuration @configuration end |
Instance Method Details
#call(env) ⇒ Object
54 55 56 |
# File 'lib/pact_broker/app.rb', line 54 def call env running_app.call env end |
#use(*args, &block) ⇒ Object
Allows middleware to be inserted at the bottom of the shared middlware stack (ie just before the cascade is called for diagnostic, UI and API). To insert middleware at the top of the stack, initialize the middleware with the app, and run it manually. eg run MyMiddleware.new(app)
40 41 42 |
# File 'lib/pact_broker/app.rb', line 40 def use *args, &block @app_builder.use *args, &block end |
#use_api_auth(middleware) ⇒ Object
private API, not sure if this will continue to be supported
45 46 47 |
# File 'lib/pact_broker/app.rb', line 45 def use_api_auth middleware @make_it_later_api_auth.make_it_later(middleware) end |
#use_ui_auth(middleware) ⇒ Object
private API, not sure if this will continue to be supported
50 51 52 |
# File 'lib/pact_broker/app.rb', line 50 def use_ui_auth middleware @make_it_later_ui_auth.make_it_later(middleware) end |