@Test public void sendMessage() { mockServer.expect(requestTo(CommunicationTemplate.MESSAGING_URL+"?oauth2_access_token=ACCESS_TOKEN")) .andExpect(method(POST)) .andExpect(jsonPath("body", is("This is a test"))) .andExpect(jsonPath("subject", is("Test message"))) .andExpect(jsonPath("recipients.values", hasSize(1))) .andExpect(jsonPath("recipients.values[0].person._path", is("/people/~"))) .andRespond(withSuccess("", MediaType.APPLICATION_JSON)); linkedIn.communicationOperations().sendMessage("Test message", "This is a test", "~"); }
public void sendMessage(String subject, String body, List<String> recipientIds) { Map<String, Object> mailboxItem = new HashMap<String,Object>(); mailboxItem.put("recipients", new Recipients(recipientIds)); mailboxItem.put("subject", subject); mailboxItem.put("body", body); restOperations.postForLocation(MESSAGING_URL, mailboxItem); }
CommunicationTemplate implements CommunicationOperations { public void sendMessage(String subject, String body, List<String> recipientIds) { Map<String, Object> mailboxItem = new HashMap<String,Object>(); mailboxItem.put("recipients", new Recipients(recipientIds)); mailboxItem.put("subject", subject); mailboxItem.put("body", body); restOperations.postForLocation(MESSAGING_URL, mailboxItem); } }
CommunicationTemplate implements CommunicationOperations { public void sendMessage(String subject, String body, List<String> recipientIds) { Map<String, Object> mailboxItem = new HashMap<String,Object>(); mailboxItem.put("recipients", new Recipients(recipientIds)); mailboxItem.put("subject", subject); mailboxItem.put("body", body); restOperations.postForLocation(MESSAGING_URL, mailboxItem); } CommunicationTemplate(RestOperations restOperations); }
CommunicationTemplate implements CommunicationOperations { public void sendMessage(String subject, String body, List<String> recipientIds) { Map<String, Object> mailboxItem = new HashMap<String,Object>(); mailboxItem.put("recipients", new Recipients(recipientIds)); mailboxItem.put("subject", subject); mailboxItem.put("body", body); restOperations.postForLocation(MESSAGING_URL, mailboxItem); } CommunicationTemplate(RestOperations restOperations); void sendMessage(String subject, String body, List<String> recipientIds); void sendMessage(String subject, String body, String... recipientIds); void connectTo(String subject, String body, String recipientId, ConnectionAuthorization connectionAuthorization); void connectTo(String subject, String body, String email, String firstName, String lastName); }
CommunicationTemplate implements CommunicationOperations { public void sendMessage(String subject, String body, List<String> recipientIds) { Map<String, Object> mailboxItem = new HashMap<String,Object>(); mailboxItem.put("recipients", new Recipients(recipientIds)); mailboxItem.put("subject", subject); mailboxItem.put("body", body); restOperations.postForLocation(MESSAGING_URL, mailboxItem); } CommunicationTemplate(RestOperations restOperations); void sendMessage(String subject, String body, List<String> recipientIds); void sendMessage(String subject, String body, String... recipientIds); void connectTo(String subject, String body, String recipientId, ConnectionAuthorization connectionAuthorization); void connectTo(String subject, String body, String email, String firstName, String lastName); static final String MESSAGING_URL; static final String PEOPLE; }