Search in sources :

Example 1 with TagWithTime

use of com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillTagsRequest method getAllTimeSeries.

public TagSeriesResponse getAllTimeSeries(BaseMandrillRequest tagsRequest) throws RequestFailedException {
    TagSeriesResponse response = new TagSeriesResponse();
    response.setList(((BaseMandrillAnonymousListResponse<TagWithTime>) request.postRequest(tagsRequest, ServiceMethods.Tags.ALL_TIME_SERIES, TagSeriesResponse.class, timeTagReference)).getList());
    return response;
}
Also used : TagWithTime(com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime) TagSeriesResponse(com.cribbstechnologies.clients.mandrill.model.response.tags.TagSeriesResponse)

Example 2 with TagWithTime

use of com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillTagsRequest method getTimeSeries.

public TagSeriesResponse getTimeSeries(MandrillRequestWithTag tagsRequest) throws RequestFailedException {
    TagSeriesResponse response = new TagSeriesResponse();
    response.setList(((BaseMandrillAnonymousListResponse<TagWithTime>) request.postRequest(tagsRequest, ServiceMethods.Tags.TIME_SERIES, TagSeriesResponse.class, timeTagReference)).getList());
    return response;
}
Also used : TagWithTime(com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime) TagSeriesResponse(com.cribbstechnologies.clients.mandrill.model.response.tags.TagSeriesResponse)

Example 3 with TagWithTime

use of com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillRESTRequestTest method testTimeTagsResponseConversion.

@Test
public void testTimeTagsResponseConversion() throws IOException {
    this.initRequestWithActualMapper();
    StringWriter sw = new StringWriter();
    IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("tags/timeSeriesResponse.txt"), sw);
    TypeReference tagListReference = new TypeReference<List<TagWithTime>>() {
    };
    BaseMandrillAnonymousListResponse<TagWithTime> response = (BaseMandrillAnonymousListResponse<TagWithTime>) this.request.convertAnonymousListResponseData(sw.toString(), TagSeriesResponse.class, tagListReference);
    assertEquals(2, response.getList().size());
    TagWithTime tag = response.getList().get(0);
    assertEquals("example time1", tag.getTime());
    assertEquals(2, tag.getSent());
    assertEquals(3, tag.getHard_bounces());
    assertEquals(4, tag.getSoft_bounces());
    assertEquals(5, tag.getRejects());
    assertEquals(6, tag.getComplaints());
    assertEquals(7, tag.getOpens());
    assertEquals(8, tag.getUnique_opens());
    assertEquals(9, tag.getClicks());
    assertEquals(10, tag.getUnique_clicks());
    tag = response.getList().get(1);
    assertEquals("example time11", tag.getTime());
    assertEquals(12, tag.getSent());
    assertEquals(13, tag.getHard_bounces());
    assertEquals(14, tag.getSoft_bounces());
    assertEquals(15, tag.getRejects());
    assertEquals(16, tag.getComplaints());
    assertEquals(17, tag.getOpens());
    assertEquals(18, tag.getUnique_opens());
    assertEquals(19, tag.getClicks());
    assertEquals(110, tag.getUnique_clicks());
}
Also used : TagWithTime(com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime) BaseMandrillAnonymousListResponse(com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse) StringWriter(java.io.StringWriter) TagSeriesResponse(com.cribbstechnologies.clients.mandrill.model.response.tags.TagSeriesResponse) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Test(org.junit.Test)

Aggregations

TagSeriesResponse (com.cribbstechnologies.clients.mandrill.model.response.tags.TagSeriesResponse)3 TagWithTime (com.cribbstechnologies.clients.mandrill.model.response.tags.TagWithTime)3 BaseMandrillAnonymousListResponse (com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1