Module: SpreeSocial
- Defined in:
- lib/spree_social.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- PROVIDERS =
[ "facebook", "twitter", "github" ]
Class Method Summary collapse
-
.init_provider(provider) ⇒ Object
We are setting these providers up regardless This way we can update them when and where necessary.
- .setup_key_for(provider, key, secret) ⇒ Object
Class Method Details
.init_provider(provider) ⇒ Object
We are setting these providers up regardless This way we can update them when and where necessary
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/spree_social.rb', line 25 def self.init_provider(provider) key, secret = nil AuthenticationMethod.where(:environment => ::Rails.env).each do |user| if user.preferred_provider == provider key = user.preferred_api_key secret = user.preferred_api_secret end end if self.table_exists?("authentication_methods") # See Below for explanation self.setup_key_for(provider.to_sym, key, secret) end |
.setup_key_for(provider, key, secret) ⇒ Object
36 37 38 39 40 |
# File 'lib/spree_social.rb', line 36 def self.setup_key_for(provider, key, secret) Devise.setup do |oa| oa.omniauth provider.to_sym, key, secret end end |