Module: SpreeSocial
- Defined in:
- lib/spree_social/engine.rb,
lib/generators/spree_social/install/install_generator.rb
Defined Under Namespace
Modules: Generators Classes: Engine
Constant Summary collapse
- OAUTH_PROVIDERS =
[ ["Facebook", "facebook"], ["Twitter", "twitter"], ["Github", "github"] ]
Class Method Summary collapse
-
.init_provider(provider) ⇒ Object
Setup all OAuth providers.
- .setup_key_for(provider, key, secret) ⇒ Object
Class Method Details
.init_provider(provider) ⇒ Object
Setup all OAuth providers
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/spree_social/engine.rb', line 28 def self.init_provider(provider) return unless ActiveRecord::Base.connection.table_exists?('spree_authentication_methods') key, secret = nil Spree::AuthenticationMethod.where(:environment => ::Rails.env).each do |auth_method| if auth_method.provider == provider key = auth_method.api_key secret = auth_method.api_secret puts("[Spree Social] Loading #{auth_method.provider.capitalize} as authentication source") end end self.setup_key_for(provider.to_sym, key, secret) end |
.setup_key_for(provider, key, secret) ⇒ Object
41 42 43 44 45 |
# File 'lib/spree_social/engine.rb', line 41 def self.setup_key_for(provider, key, secret) Devise.setup do |config| config.omniauth provider, key, secret end end |