Search in sources :

Example 1 with UrlResponse

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());
}
Also used : BaseMandrillAnonymousListResponse(com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse) StringWriter(java.io.StringWriter) TimeUrlResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.TimeUrlResponse) UrlResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse) TypeReference(com.fasterxml.jackson.core.type.TypeReference) UrlListResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse) Test(org.junit.Test)

Example 2 with UrlResponse

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;
}
Also used : UrlResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse) UrlListResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse)

Example 3 with UrlResponse

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;
}
Also used : UrlResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse) UrlListResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse)

Example 4 with UrlResponse

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;
}
Also used : UrlResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse) UrlListResponse(com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse)

Aggregations

UrlListResponse (com.cribbstechnologies.clients.mandrill.model.response.urls.UrlListResponse)4 UrlResponse (com.cribbstechnologies.clients.mandrill.model.response.urls.UrlResponse)4 BaseMandrillAnonymousListResponse (com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse)1 TimeUrlResponse (com.cribbstechnologies.clients.mandrill.model.response.urls.TimeUrlResponse)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1