Class: Opro::Oauth::TestsController
- Inherits:
-
OproController
- Object
- ApplicationController
- OproController
- Opro::Oauth::TestsController
- Defined in:
- app/controllers/opro/oauth/tests_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/opro/oauth/tests_controller.rb', line 26 def create result = if valid_oauth? {:status => 200, :message => 'OAuth worked!', :params => params, :user_id => oauth_user.id } else {:status => :unauthorized, :message => "OAuth did not work :( #{}", :params => params} end respond_to do |format| format.html do render :text => result.to_json, :status => result[:status], :layout => true end format.json do render :json => result, :status => result[:status] end end end |
#destroy ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/opro/oauth/tests_controller.rb', line 43 def destroy result = if valid_oauth? {:status => 200, :message => 'OH NO!!! OAuth is disabled on this action; this is bad', :params => params} else {:status => :unauthorized, :message => "OAuth is disabled on this action; this is the correct result!", :params => params} end respond_to do |format| format.html do render :text => result.to_json, :status => result[:status], :layout => true end format.json do render :json => result, :status => result[:status] end end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/opro/oauth/tests_controller.rb', line 5 def index end |
#show ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/opro/oauth/tests_controller.rb', line 9 def show result = if valid_oauth? {:status => 200, :message => 'OAuth worked!', :params => params, :user_id => oauth_user.id } else {:status => :unauthorized, :message => "OAuth did not work :( #{}", :params => params} end respond_to do |format| format.html do render :text => result.to_json, :status => result[:status], :layout => true end format.json do render :json => result, :status => result[:status] end end end |