Class: OauthClientsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- OauthClientsController
- Defined in:
- app/controllers/oauth_clients_controller.rb
Overview
Copyright © 2010 ThoughtWorks Inc. (thoughtworks.com) Licenced under the MIT License (www.opensource.org/licenses/mit-license.php)
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Oauth2::Provider::TransactionHelper
Methods included from Oauth2::Provider::SslHelper
Instance Method Details
#create ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/oauth_clients_controller.rb', line 36 def create @oauth_client = Oauth2::Provider::OauthClient.new(params[:oauth_client]) respond_to do |format| if @oauth_client.save flash[:notice] = 'OAuth client was successfully created.' format.html { redirect_to :action => 'index' } format.xml { render :xml => @oauth_client, :status => :created, :location => @oauth_client } else flash.now[:error] = @oauth_client.errors. format.html { render :action => "new" } format.xml { render :xml => @oauth_client.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/oauth_clients_controller.rb', line 69 def destroy @oauth_client = Oauth2::Provider::OauthClient.find(params[:id]) @oauth_client.destroy respond_to do |format| flash[:notice] = 'OAuth client was successfully deleted.' format.html { redirect_to(oauth_clients_url) } format.xml { head :ok } end end |
#edit ⇒ Object
32 33 34 |
# File 'app/controllers/oauth_clients_controller.rb', line 32 def edit @oauth_client = Oauth2::Provider::OauthClient.find(params[:id]) end |
#index ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/controllers/oauth_clients_controller.rb', line 12 def index @oauth_clients = Oauth2::Provider::OauthClient.all.sort{|a, b| a.name.casecmp(b.name)} respond_to do |format| format.html format.xml { render :xml => @oauth_clients.to_xml(:root => 'oauth_clients', :dasherize => false) } end end |
#new ⇒ Object
28 29 30 |
# File 'app/controllers/oauth_clients_controller.rb', line 28 def new @oauth_client = Oauth2::Provider::OauthClient.new end |
#show ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/controllers/oauth_clients_controller.rb', line 20 def show @oauth_client = Oauth2::Provider::OauthClient.find(params[:id]) respond_to do |format| format.html format.xml { render :xml => @oauth_client.to_xml(:dasherize => false) } end end |
#update ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/oauth_clients_controller.rb', line 52 def update @oauth_client = Oauth2::Provider::OauthClient.find(params[:id]) respond_to do |format| if @oauth_client.update_attributes(params[:oauth_client]) flash[:notice] = 'OAuth client was successfully updated.' format.html { redirect_to :action => 'index' } format.xml { head :ok } else flash.now[:error] = @oauth_client.errors. format.html { render :action => "edit" } format.xml { render :xml => @oauth_client.errors, :status => :unprocessable_entity } end end end |