use of com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testUrlListResponseConversion.
@Test
public void testUrlListResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("urls/urlList.txt"), sw);
TypeReference urlListReference = new TypeReference<List<UrlResponse>>() {
};
BaseMandrillAnonymousListResponse<UrlResponse> response = (BaseMandrillAnonymousListResponse<UrlResponse>) this.request.convertAnonymousListResponseData(sw.toString(), UrlListResponse.class, urlListReference);
assertEquals(2, response.getList().size());
UrlResponse urlResponse = response.getList().get(0);
assertEquals("example url1", urlResponse.getUrl());
assertEquals(2, urlResponse.getSent());
assertEquals(3, urlResponse.getClicks());
assertEquals(4, urlResponse.getUnique_clicks());
urlResponse = response.getList().get(1);
assertEquals("example url11", urlResponse.getUrl());
assertEquals(12, urlResponse.getSent());
assertEquals(13, urlResponse.getClicks());
assertEquals(14, urlResponse.getUnique_clicks());
}
use of com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillUrlsRequest method doSearch.
public UrlListResponse doSearch(MandrillRequestWithQuery searchRequest) throws RequestFailedException {
UrlListResponse response = new UrlListResponse();
response.setList(((BaseMandrillAnonymousListResponse<UrlResponse>) request.postRequest(searchRequest, ServiceMethods.Urls.SEARCH, UrlListResponse.class, urlsListReference)).getList());
return response;
}
use of com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillUrlsRequest method getList.
public UrlListResponse getList(BaseMandrillRequest listRequest) throws RequestFailedException {
UrlListResponse response = new UrlListResponse();
response.setList(((BaseMandrillAnonymousListResponse<UrlResponse>) request.postRequest(listRequest, ServiceMethods.Urls.LIST, UrlListResponse.class, urlsListReference)).getList());
return response;
}
use of com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillUrlsRequest method getTimeSeries.
public UrlListResponse getTimeSeries(MandrillRequestWithUrl seriesRequest) throws RequestFailedException {
UrlListResponse response = new UrlListResponse();
response.setList(((BaseMandrillAnonymousListResponse<UrlResponse>) request.postRequest(seriesRequest, ServiceMethods.Urls.TIME_SERIES, UrlListResponse.class, urlsListReference)).getList());
return response;
}
Aggregations