Class: OmniAuth::Builder

Inherits:
Rack::Builder
  • Object
show all
Defined in:
lib/omniauth/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, &block) ⇒ Builder

Returns a new instance of Builder.



5
6
7
8
# File 'lib/omniauth/builder.rb', line 5

def initialize(app, &block)
  @app = app
  super(&block)
end

Instance Method Details

#call(env) ⇒ Object



28
29
30
31
# File 'lib/omniauth/builder.rb', line 28

def call(env)
  @ins << @app unless @ins.include?(@app)
  to_app.call(env)
end

#configure(&block) ⇒ Object



14
15
16
# File 'lib/omniauth/builder.rb', line 14

def configure(&block)
  OmniAuth.configure(&block)
end

#on_failure(&block) ⇒ Object



10
11
12
# File 'lib/omniauth/builder.rb', line 10

def on_failure(&block)
  OmniAuth.config.on_failure = block
end

#provider(klass, *args, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/omniauth/builder.rb', line 18

def provider(klass, *args, &block)
  if klass.is_a?(Class)
    middleware = klass
  else
    middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
  end

  use middleware, *args, &block
end