class OmniAuth::Builder
Public Class Methods
new(app, &block)
click to toggle source
Calls superclass method
# File lib/omniauth/builder.rb, line 3 def initialize(app, &block) @options = nil if rack14? || rack2? super else @app = app super(&block) @ins << @app end end
Public Instance Methods
before_callback_phase(&block)
click to toggle source
# File lib/omniauth/builder.rb, line 34 def before_callback_phase(&block) OmniAuth.config.before_callback_phase = block end
before_options_phase(&block)
click to toggle source
# File lib/omniauth/builder.rb, line 26 def before_options_phase(&block) OmniAuth.config.before_options_phase = block end
before_request_phase(&block)
click to toggle source
# File lib/omniauth/builder.rb, line 30 def before_request_phase(&block) OmniAuth.config.before_request_phase = block end
call(env)
click to toggle source
# File lib/omniauth/builder.rb, line 62 def call(env) to_app.call(env) end
configure(&block)
click to toggle source
# File lib/omniauth/builder.rb, line 38 def configure(&block) OmniAuth.configure(&block) end
on_failure(&block)
click to toggle source
# File lib/omniauth/builder.rb, line 22 def on_failure(&block) OmniAuth.config.on_failure = block end
options(options = false)
click to toggle source
# File lib/omniauth/builder.rb, line 42 def options(options = false) return @options || {} if options == false @options = options end
provider(klass, *args, &block)
click to toggle source
# File lib/omniauth/builder.rb, line 47 def provider(klass, *args, &block) if klass.is_a?(Class) middleware = klass else begin middleware = OmniAuth::Strategies.const_get(OmniAuth::Utils.camelize(klass.to_s).to_s) rescue NameError raise(LoadError.new("Could not find matching strategy for #{klass.inspect}. You may need to install an additional gem (such as omniauth-#{klass}).")) end end args.last.is_a?(Hash) ? args.push(options.merge(args.pop)) : args.push(options) use middleware, *args, &block end
rack14?()
click to toggle source
# File lib/omniauth/builder.rb, line 14 def rack14? Rack.release.start_with?('1.') && (Rack.release.split('.')[1].to_i >= 4) end
rack2?()
click to toggle source
# File lib/omniauth/builder.rb, line 18 def rack2? Rack.release.start_with? '2.' end