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