Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Add support for message metadata, senders/check-domain API #35

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 48 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,50 +33,58 @@
</scm>

<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>


</dependencies>

<build>
<plugins>
<!-- Compile against 1.5 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
<plugins>
<!-- Compile against 1.5 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cribbstechnologies.clients.mandrill.exception;

public class RequestFailedException extends Throwable {
public class RequestFailedException extends Exception {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.cribbstechnologies.clients.mandrill.model;

/**
*
* @author Martin Zapata
*
*/

public class Attachment implements java.io.Serializable {

private String type, name, content;

public Attachment(String type, String name, String content) {
this.type = type;
this.name = name;
this.content = content;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getContent() {
return content;
}

public void setContent(String content) {
this.content = content;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ public class MandrillMessage {
private String[] tags = new String[0];
private String[] google_analytics_domains = new String[0];
private String[] google_analytics_campaign = new String[0];
private List<MergeVar> global_merge_vars;
List<MessageMergeVars> merge_vars;

private Map<String, String> metadata;
private List<MergeVar> global_merge_vars;
List<MessageMergeVars> merge_vars;
private String subaccount;
private List<Attachment> attachments;
private Map<String, String> headers;

public String getSubject() {
Expand Down Expand Up @@ -142,4 +144,28 @@ public List<MessageMergeVars> getMerge_vars() {
public void setMerge_vars(List<MessageMergeVars> merge_vars) {
this.merge_vars = merge_vars;
}

public List<Attachment> getAttachments() {
return attachments;
}

public void setAttachments(List<Attachment> attachments) {
this.attachments = attachments;
}

public String getSubaccount() {
return subaccount;
}

public void setSubaccount(String subaccount) {
this.subaccount = subaccount;
}

public Map<String, String> getMetadata() {
return metadata;
}

public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ public MandrillMessage getMessage() {
public void setMessage(MandrillHtmlMessage message) {
this.message = message;
}



}
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
package com.cribbstechnologies.clients.mandrill.model;

public class MandrillRecipient {

String email;
String name;

public MandrillRecipient(String name, String email) {
this.email = email;
this.name = name;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}


String email;
String name;
String type;

public MandrillRecipient(String name, String email) {
this.email = email;
this.name = name;
}

public MandrillRecipient(String name, String email, String type) {
this(name, email);
this.type = type;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class Senders {
public static final String DOMAINS = "senders/domain.json";
public static final String INFO = "senders/info.json";
public static final String TIME_SERIES = "senders/time-series.json";
public static final String CHECK_DOMAIN = "senders/check-domain.json";
}

public class Urls {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* AuthenticationInfo.java
*
* Created on Apr 27, 2016, 1:07:39 PM
*
* Copyright (C) 2014, Blueprint Solutions Inc.
* All rights reserved.
*/

package com.cribbstechnologies.clients.mandrill.model.response.senders;

/**
*
* @author Aleem Sunderji, [email protected]
*/
public class AuthenticationInfo {

// Instance variables
protected boolean valid;
protected String valid_after;
protected String error;

public boolean isValid() {
return valid;
}

public void setValid(boolean valid) {
this.valid = valid;
}

public String getValid_after() {
return valid_after;
}

public void setValid_after(String valid_after) {
this.valid_after = valid_after;
}

public String getError() {
return error;
}

public void setError(String error) {
this.error = error;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.cribbstechnologies.clients.mandrill.model.response.senders;

import com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillResponse;

public class DomainInfoResponse extends BaseMandrillResponse {

protected String domain;
protected String created_at;
protected String last_tested_at;
protected AuthenticationInfo spf;
protected AuthenticationInfo dkim;
protected String verified_at;
protected boolean valid_signing;

public String getDomain() {
return domain;
}

public void setDomain(String domain) {
this.domain = domain;
}

public String getCreated_at() {
return created_at;
}

public void setCreated_at(String created_at) {
this.created_at = created_at;
}

public String getLast_tested_at() {
return last_tested_at;
}

public void setLast_tested_at(String last_tested_at) {
this.last_tested_at = last_tested_at;
}

public String getVerified_at() {
return verified_at;
}

public void setVerified_at(String verified_at) {
this.verified_at = verified_at;
}

public boolean isValid_signing() {
return valid_signing;
}

public void setValid_signing(boolean valid_signing) {
this.valid_signing = valid_signing;
}

public AuthenticationInfo getSpf() {
return spf;
}

public void setSpf(AuthenticationInfo spf) {
this.spf = spf;
}

public AuthenticationInfo getDkim() {
return dkim;
}

public void setDkim(AuthenticationInfo dkim) {
this.dkim = dkim;
}

}
Loading