Class: Admin::VimeoAccountController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::VimeoAccountController
- Includes:
- Refinery::VimeoVideos::Account
- Defined in:
- app/controllers/admin/vimeo_account_controller.rb
Instance Method Summary collapse
Instance Method Details
#authorization ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/admin/vimeo_account_controller.rb', line 6 def if not and # begin authorization process base = Vimeo::Advanced::Base.new( account[:consumer_key], account[:consumer_secret]) request_token = base.get_request_token session[:oauth_secret] = request_token.secret redirect_to base. elsif # already authorized flash.notice = "You have already authorized your account." redirect_to refinery_root_path else # not ready to authorize flash.alert = "You are not ready to authorize. Type in consumer_key and consumer_secret." redirect_to refinery_root_path end end |
#callback ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/admin/vimeo_account_controller.rb', line 34 def callback # vimeo will redirect us here upon successful authorization base = Vimeo::Advanced::Base.new( account[:consumer_key], account[:consumer_secret]) access_token = base.get_access_token(params[:oauth_token], session[:oauth_secret], params[:oauth_verifier]) RefinerySetting.find_by_name('vimeo_token').update_attribute(:value, access_token.token) RefinerySetting.find_by_name('vimeo_secret').update_attribute(:value, access_token.secret) flash.notice = "You successfully authorized your vimeo account for integration in your backend. You can now start using it." redirect_to refinery_root_path end |