Module: SpreeSocial
- Defined in:
- lib/spree_social.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- OAUTH_PROVIDERS =
[ ["Bit.ly", "bitly"], ["Evernote", "evernote"], ["Facebook", "facebook"], ["Foursquare", "foursquare"], ["Github", "github"], ["Google", "google"] , ["Gowalla", "gowalla"], ["instagr.am", "instagram"], ["Instapaper", "instapaper"], ["LinkedIn", "linked_in"], ["37Signals (Basecamp, Campfire, etc)", "thirty_seven_signals"], ["Twitter", "twitter"], ["Vimeo", "vimeo"], ["Yahoo!", "yahoo"], ["YouTube", "you_tube"] ]
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
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/spree_social.rb', line 29 def self.init_provider(provider) key, secret = nil AuthenticationMethod.where(:environment => ::Rails.env).each do |user| if user.preferred_provider == provider[1] key = user.preferred_api_key secret = user.preferred_api_secret puts("Loaded #{user.preferred_provider.capitalize} as authentication source") end end if self.table_exists?("authentication_methods") # See Below for explanation self.setup_key_for(provider[1].to_sym, key, secret) end |
.setup_key_for(provider, key, secret) ⇒ Object
41 42 43 44 45 |
# File 'lib/spree_social.rb', line 41 def self.setup_key_for(provider, key, secret) Devise.setup do |oa| oa.omniauth provider.to_sym, key, secret end end |