Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Adds simple interfaces for ETClient and ETRestConnection. #73

Open
wants to merge 1 commit into
base: development
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
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@
</dependency>
</dependencies>
</plugin>
<plugin>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is not wanted / constitutes a breaking change, it can be removed along with the @OverRide annotations.

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down
20 changes: 7 additions & 13 deletions src/main/java/com/exacttarget/fuelsdk/ETClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* client library.
*/

public class ETClient {
public class ETClient implements IETClient {
private static Logger logger = Logger.getLogger(ETClient.class);

private static final String DEFAULT_PROPERTIES_FILE_NAME =
Expand All @@ -76,13 +76,6 @@ public class ETClient {
private String clientId = null;
private String clientSecret = null;

private String username = null;
private String password = null;

private String endpoint = null;
private String authEndpoint = null;
private String soapEndpoint = null;

private Boolean autoHydrateObjects = true;

private Gson gson = null;
Expand Down Expand Up @@ -129,18 +122,18 @@ public ETClient(ETConfiguration configuration)
clientId = configuration.get("clientId");
clientSecret = configuration.get("clientSecret");

username = configuration.get("username");
password = configuration.get("password");
String username = configuration.get("username");
String password = configuration.get("password");

endpoint = configuration.get("endpoint");
String endpoint = configuration.get("endpoint");
if (endpoint == null) {
endpoint = DEFAULT_ENDPOINT;
}
authEndpoint = configuration.get("authEndpoint");
String authEndpoint = configuration.get("authEndpoint");
if (authEndpoint == null) {
authEndpoint = DEFAULT_AUTH_ENDPOINT;
}
soapEndpoint = configuration.get("soapEndpoint");
String soapEndpoint = configuration.get("soapEndpoint");

GsonBuilder gsonBuilder = new GsonBuilder()
.excludeFieldsWithoutExposeAnnotation()
Expand Down Expand Up @@ -250,6 +243,7 @@ public Gson getGson() {
*
* @return The ETRestConnection
*/
@Override
public ETRestConnection getRestConnection() {
return restConnection;
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/exacttarget/fuelsdk/ETRestConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* connection to the Salesforce Marketing Cloud REST API.
*/

public class ETRestConnection {
public class ETRestConnection implements IETRestConnection {
private static Logger logger = Logger.getLogger(ETRestConnection.class);

private ETClient client = null;
Expand Down Expand Up @@ -100,6 +100,7 @@ public ETRestConnection(ETClient client, String endpoint, boolean isAuthConnecti
* @param path The path to GET the response
* @return The Response object
*/
@Override
public Response get(String path)
throws ETSdkException
{
Expand All @@ -126,6 +127,7 @@ public Response get(String path)
* @param path The path to POST or create
* @return The Response object
*/
@Override
public Response post(String path, String payload)
throws ETSdkException
{
Expand All @@ -152,6 +154,7 @@ public Response post(String path, String payload)
* @param path The path to PATCH or update
* @return The Response object
*/
@Override
public Response patch(String path, String payload)
throws ETSdkException
{
Expand All @@ -178,6 +181,7 @@ public Response patch(String path, String payload)
* @param path The path to DELETE
* @return The Response object
*/
@Override
public Response delete(String path)
throws ETSdkException
{
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/exacttarget/fuelsdk/IETClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.exacttarget.fuelsdk;

public interface IETClient {
IETRestConnection getRestConnection();
}
10 changes: 10 additions & 0 deletions src/main/java/com/exacttarget/fuelsdk/IETRestConnection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.exacttarget.fuelsdk;

import com.exacttarget.fuelsdk.ETRestConnection.Response;

public interface IETRestConnection {
Response get(String path) throws ETSdkException;
Response post(String path, String payload) throws ETSdkException;
Response patch(String path, String payload) throws ETSdkException;
Response delete(String path) throws ETSdkException;
}