Class: ZendeskRails::TicketsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/zendesk_rails/tickets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
40
# File 'app/controllers/zendesk_rails/tickets_controller.rb', line 32

def create
  @handler = Ticket.new(ticket_params)

  if @ticket = @handler.create
    after_created_ticket @ticket
  else
    render 'new'
  end
end

#indexObject



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

def index
  email = zendesk_user_attribute(:email)
  @tickets = Ticket.belonging_to(email)
end

#newObject



28
29
30
# File 'app/controllers/zendesk_rails/tickets_controller.rb', line 28

def new
  @handler = Ticket.new
end

#showObject



22
23
24
25
26
# File 'app/controllers/zendesk_rails/tickets_controller.rb', line 22

def show
  @ticket  = Ticket.find_request(params[:id])
  @comment = Comment.new(@ticket)
  @comments = @ticket.comments(zendesk_config.comment_list_options)
end

#updateObject



42
43
44
45
46
47
48
49
50
51
# File 'app/controllers/zendesk_rails/tickets_controller.rb', line 42

def update
  @ticket  = Ticket.find_ticket(params[:id])
  @comment = Comment.new(@ticket, comment_params)

  if @comment.save
    after_updated_ticket @ticket
  else
    render 'show'
  end
end