Package zendeskapi.models.categories

Examples of zendeskapi.models.categories.IndividualCategoryResponse


  public void testGetForumsByCategory() throws Exception {
    Categories categories = API.getCategories();
    Category category = new Category();
    category.setDescription("Test category description 99");
    category.setName("Test category name 99");
    IndividualCategoryResponse individualCategoryResponse = categories.createCategory(category);
    Category responseCategory = individualCategoryResponse.getCategory();
   
    Forum forum = new Forum();
    forum.setName("Test forum 1");
    forum.setCategoryId(responseCategory.getId());
    IndividualForumResponse individualForumResponse = API.getForums().createForum(forum);
View Full Code Here


   * @param category
   * @return
   * @throws ZendeskApiException
   */
  public IndividualCategoryResponse createCategory(Category category) throws ZendeskApiException {
    IndividualCategoryResponse categoryToCreate = new IndividualCategoryResponse();
    categoryToCreate.setCategory(category);
    try {
      return genericPost("categories.json", categoryToCreate, IndividualCategoryResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Faled to create categery " + category.getName(), e);
    }
View Full Code Here

   * @param category
   * @return
   * @throws ZendeskApiException
   */
  public IndividualCategoryResponse updateCategory(Category category) throws ZendeskApiException {
    IndividualCategoryResponse categoryToUpdate = new IndividualCategoryResponse();
    categoryToUpdate.setCategory(category);
    try {
      return genericPut("categories/" + category.getId() + ".json", categoryToUpdate, IndividualCategoryResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Update of category " + category.getName() + " failed", e);
    }
View Full Code Here

  public void testCreateCategory() throws Exception {
    Categories categories = API.getCategories();
    Category category = new Category();
    category.setDescription("Test category description 1");
    category.setName("Test category name 1");
    IndividualCategoryResponse individualCategoryResponse = categories.createCategory(category);
    Category responseCategory = individualCategoryResponse.getCategory();
    Assert.assertEquals(responseCategory.getName(), category.getName());
    Assert.assertEquals(responseCategory.getDescription(), category.getDescription());
    ids.add(responseCategory.getId());
  }
View Full Code Here

  public void testDeleteCategory() throws Exception {
    Categories categories = API.getCategories();
    Category category = new Category();
    category.setDescription("Test category description 1");
    category.setName("Test category name 1");
    IndividualCategoryResponse individualCategoryResponse = categories.createCategory(category);
    Assert.assertTrue(categories.deleteCategory(individualCategoryResponse.getCategory().getId()));
  }
View Full Code Here

  public void testGetCategoryById() throws Exception {
    createCategories();
    Categories categories = API.getCategories();
    GroupCategoryResponse groupCategoryResponse = categories.getCategories();
    for (Category category : groupCategoryResponse.getCategories()) {
      IndividualCategoryResponse individualCategoryResponse = categories.getCategoryById(category.getId());
      Category responseCategory = individualCategoryResponse.getCategory();
      Assert.assertEquals(responseCategory.getId(), category.getId());
      Assert.assertEquals(responseCategory.getName(), category.getName());
      Assert.assertEquals(responseCategory.getDescription(), category.getDescription());
    }
  }
View Full Code Here

    createCategories();
    Categories categories = API.getCategories();
    GroupCategoryResponse groupCategoryResponse = categories.getCategories();
    Category category = groupCategoryResponse.getCategories().get(0);
    category.setDescription("Test updated description 1");
    IndividualCategoryResponse individualCategoryResponse = categories.updateCategory(category);
    Category responseCategory = individualCategoryResponse.getCategory();
    Assert.assertEquals(responseCategory.getDescription(), category.getDescription());
  }
View Full Code Here

  private void createCategories() throws Exception {
    Categories categories = API.getCategories();
    Category category = new Category();
    category.setDescription("Test category description 1");
    category.setName("Test category name 1");
    IndividualCategoryResponse individualCategoryResponse = categories.createCategory(category);
    ids.add(individualCategoryResponse.getCategory().getId());
    category = new Category();
    category.setDescription("Test category description 2");
    category.setName("Test category name 2");
    individualCategoryResponse = categories.createCategory(category);
    ids.add(individualCategoryResponse.getCategory().getId());
    category = new Category();
    category.setDescription("Test category description 3");
    category.setName("Test category name 3");
    individualCategoryResponse = categories.createCategory(category);
    ids.add(individualCategoryResponse.getCategory().getId());
  }
View Full Code Here

TOP

Related Classes of zendeskapi.models.categories.IndividualCategoryResponse

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.