2012-04-10 14:06:46 +00:00
|
|
|
class TicketPrioritiesController < ApplicationController
|
|
|
|
before_filter :authentication_check
|
|
|
|
|
|
|
|
# GET /ticket_priorities
|
|
|
|
def index
|
|
|
|
@ticket_priorities = Ticket::Priority.all
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
render :json => @ticket_priorities
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# GET /ticket_priorities/1
|
|
|
|
def show
|
|
|
|
@ticket_priority = Ticket::Priority.find(params[:id])
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
render :json => @ticket_priority
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# POST /ticket_priorities
|
|
|
|
def create
|
|
|
|
@ticket_priority = Ticket::Priority.new(params[:ticket_priority])
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
if @ticket_priority.save
|
|
|
|
render :json => @ticket_priority, :status => :created
|
|
|
|
else
|
|
|
|
render :json => @ticket_priority.errors, :status => :unprocessable_entity
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# PUT /ticket_priorities/1
|
|
|
|
def update
|
|
|
|
@ticket_priority = Ticket::Priority.find(params[:id])
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
if @ticket_priority.update_attributes(params[:ticket_priority])
|
|
|
|
render :json => @ticket_priority, :status => :ok
|
|
|
|
else
|
|
|
|
render :json => @ticket_priority.errors, :status => :unprocessable_entity
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# DELETE /ticket_priorities/1
|
|
|
|
def destroy
|
|
|
|
@ticket_priority = Ticket::Priority.find(params[:id])
|
|
|
|
@ticket_priority.destroy
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
head :ok
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
end
|