Module: OAuthAdapter::ProviderSaving

Defined in:
lib/oauth_adapter/omniauth.rb

Instance Method Summary collapse

Instance Method Details

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



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/oauth_adapter/omniauth.rb', line 3

def provider(klass, *args, &block)
  super

  if klass.is_a?(Class)
    name = klass.name.split('::').last.downcase
    strategy_class = klass
  else
    name = klass
    class_name = OmniAuth::Utils.camelize(klass)
    strategy_class = OmniAuth::Strategies.const_get(class_name)
  end
  client_options = strategy_class.default_options.client_options
  site = client_options.site if client_options

  OAuthAdapter.config.provider(name, args[0], args[1], site) if site
end