@Test public void getFollowing() { mockServer.expect(requestTo(CompanyTemplate.COMPANY_FOLLOW_URL + "?oauth2_access_token=ACCESS_TOKEN")).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("following.json", getClass()), MediaType.APPLICATION_JSON)); List<Company> companies = linkedIn.companyOperations().getFollowing(); assertEquals(6, companies.size()); assertEquals("amworks", companies.get(0).getName()); }
public List<Company> getFollowing() { JsonNode node = restOperations.getForObject(COMPANY_FOLLOW_URL, JsonNode.class); try { return objectMapper.reader(new TypeReference<List<Company>>(){}).readValue(node.path("values")); } catch (Exception e) { throw new RuntimeException(e); } }
CompanyTemplate extends AbstractTemplate implements CompanyOperations { public List<Company> getFollowing() { JsonNode node = restOperations.getForObject(COMPANY_FOLLOW_URL, JsonNode.class); try { return objectMapper.reader(new TypeReference<List<Company>>(){}).readValue(node.path("values")); } catch (Exception e) { throw new RuntimeException(e); } } }
CompanyTemplate extends AbstractTemplate implements CompanyOperations { public List<Company> getFollowing() { JsonNode node = restOperations.getForObject(COMPANY_FOLLOW_URL, JsonNode.class); try { return objectMapper.reader(new TypeReference<List<Company>>(){}).readValue(node.path("values")); } catch (Exception e) { throw new RuntimeException(e); } } CompanyTemplate(RestOperations RestOperations, ObjectMapper objectMapper); }
CompanyTemplate extends AbstractTemplate implements CompanyOperations { public List<Company> getFollowing() { JsonNode node = restOperations.getForObject(COMPANY_FOLLOW_URL, JsonNode.class); try { return objectMapper.reader(new TypeReference<List<Company>>(){}).readValue(node.path("values")); } catch (Exception e) { throw new RuntimeException(e); } } CompanyTemplate(RestOperations RestOperations, ObjectMapper objectMapper); Company getCompany(int id); Company getCompanyByUniversalName(String name); List<Company> getCompaniesByEmailDomain(String domain); Companies search(String keywords); List<Company> getFollowing(); List<Company> getSuggestionsToFollow(); void startFollowingCompany(int id); void stopFollowingCompany(int id); Products getProducts(int companyId, int start, int count); }
CompanyTemplate extends AbstractTemplate implements CompanyOperations { public List<Company> getFollowing() { JsonNode node = restOperations.getForObject(COMPANY_FOLLOW_URL, JsonNode.class); try { return objectMapper.reader(new TypeReference<List<Company>>(){}).readValue(node.path("values")); } catch (Exception e) { throw new RuntimeException(e); } } CompanyTemplate(RestOperations RestOperations, ObjectMapper objectMapper); Company getCompany(int id); Company getCompanyByUniversalName(String name); List<Company> getCompaniesByEmailDomain(String domain); Companies search(String keywords); List<Company> getFollowing(); List<Company> getSuggestionsToFollow(); void startFollowingCompany(int id); void stopFollowingCompany(int id); Products getProducts(int companyId, int start, int count); static final String BASE_URL; static final String COMPANY_FIELDS; static final String COMPANY_URL; static final String COMPANY_SEARCH_URL; static final String COMPANY_FOLLOW_URL; static final String COMPANY_FOLLOW_START_STOP_URL; static final String COMPANY_SUGGESTIONS_TO_FOLLOW; static final String PRODUCT_FIELDS; static final String PRODUCTS_URL; }