Package zendeskapi.models.tickets

Examples of zendeskapi.models.tickets.Ticket


  public JobStatusResponse bulkUpdate(List<Long> ids, BulkUpdate info) throws ZendeskApiException {
    StringBuilder csvs = new StringBuilder();
    for (Long id : ids) {
      csvs.append(id.toString()).append(",");
    }
    Ticket ticket = convertBulkUpdateToTicket(info);
    try {
      return genericPut("tickets/update_many.json?ids=" + csvs.toString(), ticket, JobStatusResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException(e);
    }
View Full Code Here


      throw new ZendeskApiException(e);
    }
  }

  private Ticket convertBulkUpdateToTicket(BulkUpdate bulk) {
    Ticket ticket = new Ticket();
    ticket.setType(bulk.getType());
    ticket.setStatus(bulk.getStatus().getValue());
    ticket.setTags(bulk.getTags());
    ticket.setSubject(bulk.getSubject());
    ticket.setComment(bulk.getComment());
    ticket.setAssigneeId(bulk.getAssigneeId());
    ticket.setCollaboratorEmails(bulk.getCollaboratorEmails());
    return ticket;
  }
View Full Code Here

    Assert.assertTrue(ticketsByUser.size() > 0);
  }

  @Test
  public void testGetTicketById() throws Exception {
    Ticket ticket = API.getTickets().getTicket(ID).getTicket();
    Assert.assertNotNull(ticket);
    Assert.assertEquals(ticket.getId(), ID);
  }
View Full Code Here

    Assert.assertTrue(tickets.size() > 0);
  }

  @Test
  public void testCreateUpdateAndDeleteTicket() throws Exception {
    Ticket ticket = new Ticket();
    ticket.setSubject("My printer is on fire");
    ticket.setDescription("Please send support");
    ticket.setPriority(Priority.high);
    List<CustomField> customFields = new ArrayList<CustomField>();
    CustomField customField = new CustomField();
    customField.setId(CUSTOM_FIELD_ID);
    customField.setValue("testing");
    customFields.add(customField);
    ticket.setCustomFields(customFields);
    Ticket createdTicket = API.getTickets().createTicket(ticket).getTicket();
    Assert.assertNotNull(createdTicket);
    Assert.assertTrue(createdTicket.getId() > 0);

    ticket = new Ticket();
    ticket.setId(createdTicket.getId());
//    ticket.setStatus(TicketStatus.open);
//    ticket.setAssigneeId(USER_ID);
//    List<String> collaboratorEmails = new ArrayList<String>();
//    collaboratorEmails.add(COLLABORATOR_EMAIL);
//    ticket.setCollaboratorEmails(collaboratorEmails);
    String body = "Got it, thanks";
    Comment newComment = new Comment();
    newComment.setBody(body);
    newComment.setPublicComment(true);
    IndividualTicketResponse res = API.getTickets().updateTicket(ticket, newComment);
    Ticket updatedTicket = res.getTicket();
    Assert.assertNotNull(updatedTicket);
    Assert.assertEquals(res.getAudit().getEvents().get(0).getBody(), body);

    //Delete
    Assert.assertTrue(API.getTickets().delete(createdTicket.getId()));
View Full Code Here

    responseMacro.setTitle("Test Macro 2");
    Macro updateMacro = API.getMacros().updateMacro(responseMacro).getMacro();
    Assert.assertEquals(updateMacro.getId(), responseMacro.getId());
   
    // Apply
    Ticket ticket = new Ticket();
    ticket.setSubject("Macro test ticket");
    ticket.setDescription("Testing macros");
    ticket.setPriority(Priority.NORMAL);
    Ticket responseTicket = API.getTickets().createTicket(ticket).getTicket();
    Ticket applyTicket = API.getMacros().applyMacroToTicket(responseTicket.getId(), responseMacro.getId()).getResult().getTicket();
    Assert.assertEquals(applyTicket.getStatus(), "open");
   
    // Delete
    Assert.assertTrue(API.getTickets().delete(responseTicket.getId()));
    Assert.assertTrue(API.getMacros().deleteMacro(responseMacro.getId()));
  }
View Full Code Here

TOP

Related Classes of zendeskapi.models.tickets.Ticket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.