Class: OohAuth::AuthenticatingClients

Inherits:
Application
  • Object
show all
Defined in:
app/controllers/authenticating_clients.rb

Instance Method Summary collapse

Instance Method Details

#create(authenticating_client) ⇒ Object



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

def create(authenticating_client)
  @authenticating_client = OohAuth::AuthenticatingClient.new_for_user(session.user, authenticating_client)
  if @authenticating_client.save
    headers['Location'] = slice_url(:authenticating_client, @authenticating_client)
    render :show, :status=>201
  else
    message[:error] = "There were problems creating the Application."
    render :new
  end
end

#destroy(id) ⇒ Object

Raises:

  • (NotFound)


50
51
52
53
54
55
56
57
58
# File 'app/controllers/authenticating_clients.rb', line 50

def destroy(id)
  @authenticating_client = OohAuth::AuthenticatingClient.get(id)
  raise NotFound unless @authenticating_client and @authenticating_client.editable_by?(session.user)
  if @authenticating_client.destroy
    redirect slice_url(:authenticating_clients)
  else
    raise InternalServerError
  end
end

#edit(id) ⇒ Object

Raises:

  • (NotFound)


33
34
35
36
37
# File 'app/controllers/authenticating_clients.rb', line 33

def edit(id)
  @authenticating_client = OohAuth::AuthenticatingClient.get(id)
  raise NotFound unless @authenticating_client and @authenticating_client.editable_by?(session.user)
  display @authenticating_client, :edit
end

#indexObject



6
7
8
9
# File 'app/controllers/authenticating_clients.rb', line 6

def index
  @authenticating_clients = OohAuth::AuthenticatingClient.find_for_user(session.user)
  render :index
end

#newObject



17
18
19
20
# File 'app/controllers/authenticating_clients.rb', line 17

def new
  @authenticating_client = OohAuth::AuthenticatingClient.new
  display @authenticating_client
end

#show(id) ⇒ Object

Raises:

  • (NotFound)


11
12
13
14
15
# File 'app/controllers/authenticating_clients.rb', line 11

def show(id)
  @authenticating_client = OohAuth::AuthenticatingClient.get(id)
  raise NotFound unless @authenticating_client and @authenticating_client.editable_by?(session.user)
  display @authenticating_client, :show
end

#update(id, authenticating_client) ⇒ Object

Raises:

  • (NotFound)


39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/authenticating_clients.rb', line 39

def update(id, authenticating_client)
  @authenticating_client = OohAuth::AuthenticatingClient.get(id)
  raise NotFound unless @authenticating_client and @authenticating_client.editable_by?(session.user)
  if @authenticating_client.update_attributes(authenticating_client)
    message[:success] = "Application updated successfully!"
    redirect slice_url(:authenticating_client, @authenticating_client)
  else
    display @authenticating_client, :edit
  end
end