Class: Opro::Oauth::TestsController

Inherits:
OproController
  • Object
show all
Defined in:
app/controllers/opro/oauth/tests_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/opro/oauth/tests_controller.rb', line 21

def create
  result = oauth_result(params)
  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

#destroyObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/opro/oauth/tests_controller.rb', line 33

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

#indexObject



5
6
7
# File 'app/controllers/opro/oauth/tests_controller.rb', line 5

def index

end

#showObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/opro/oauth/tests_controller.rb', line 9

def show
  result = oauth_result(params)
  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