Class: FacebookApp::FacebookCredentials
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- FacebookApp::FacebookCredentials
- Defined in:
- app/models/facebook_app/facebook_credentials.rb
Class Method Summary collapse
- .advertising_url ⇒ Object
- .app_access_token ⇒ Object
- .app_id ⇒ Object
- .app_url ⇒ Object
- .current_credentials ⇒ Object
- .email ⇒ Object
- .password ⇒ Object
- .register_app_access_token ⇒ Object
- .secret ⇒ Object
- .seed_initial_credentials ⇒ Object
- .viral_url ⇒ Object
Class Method Details
.advertising_url ⇒ Object
26 27 28 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 26 def advertising_url app_url + "?marketing_mode=advertising" end |
.app_access_token ⇒ Object
34 35 36 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 34 def app_access_token current_credentials.app_access_token || register_app_access_token end |
.app_id ⇒ Object
18 19 20 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 18 def app_id current_credentials.app_id end |
.app_url ⇒ Object
43 44 45 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 43 def app_url current_credentials.app_url end |
.current_credentials ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 55 def current_credentials if count == 0 seed_initial_credentials end if Rails.env.development? last_development_config.last else last_production_config.last end end |
.email ⇒ Object
47 48 49 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 47 def email current_credentials.email end |
.password ⇒ Object
51 52 53 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 51 def password current_credentials.password end |
.register_app_access_token ⇒ Object
38 39 40 41 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 38 def register_app_access_token oauth = Koala::Facebook::OAuth.new(FacebookApp::FacebookCredentials.app_id, FacebookApp::FacebookCredentials.secret) FacebookApp::FacebookCredentials.current_credentials.update_attribute(:app_access_token, oauth.get_app_access_token) end |
.secret ⇒ Object
30 31 32 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 30 def secret current_credentials.secret end |
.seed_initial_credentials ⇒ Object
13 14 15 16 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 13 def seed_initial_credentials create(:development => true, :app_id => "225198020866871", :secret => "c13ca68717af076f6832f4d38a6da48a", :app_url => "http://apps.facebook.com/the-better-frienddev", :email => "[email protected]", :password => "notteling" ) create(:development => false, :app_id => "178965915518857", :secret => "928b9a0edf812a236499bcc99da7a4bc", :app_url => 'https://apps.facebook.com/truthcanhurt', :email => "dummydata", :password => "dummydata") end |
.viral_url ⇒ Object
22 23 24 |
# File 'app/models/facebook_app/facebook_credentials.rb', line 22 def app_url + "?marketing_mode=viral" end |