Skip to content

Commit

Permalink
made headers retrieval method bit clear
Browse files Browse the repository at this point in the history
er
  • Loading branch information
ibalosh committed Nov 20, 2017
1 parent dd4d018 commit 3b7e6f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/wildbit/java/postmark/Postmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class Postmark {

/**
* Base Application Constants
* Base Postmark APP Constants
*/
public enum DEFAULTS {
API_URL("api.postmarkapp.com"),
Expand Down Expand Up @@ -43,7 +43,7 @@ public static MultivaluedHashMap<String, String> headers() {

}

private static MultivaluedHashMap getHeaders(DEFAULTS authType, String apiToken) {
private static MultivaluedHashMap getHeadersWithAuth(DEFAULTS authType, String apiToken) {
MultivaluedHashMap headers = DefaultHeaders.headers();
headers.add(authType.value, apiToken);
return headers;
Expand All @@ -59,22 +59,22 @@ private static String libraryVersion() {
return prop.getProperty("Version");
}

// main methods for accessing API clients
// public class methods for accessing API clients

public static ApiClient getApiClient(String apiToken) {
return new ApiClient(DEFAULTS.API_URL.value, getHeaders(DEFAULTS.SERVER_AUTH_HEADER, apiToken));
return new ApiClient(DEFAULTS.API_URL.value, getHeadersWithAuth(DEFAULTS.SERVER_AUTH_HEADER, apiToken));
}

public static ApiClient getApiClient(String apiToken, Boolean secureConnection) {
return new ApiClient(DEFAULTS.API_URL.value, getHeaders(DEFAULTS.SERVER_AUTH_HEADER, apiToken), secureConnection);
return new ApiClient(DEFAULTS.API_URL.value, getHeadersWithAuth(DEFAULTS.SERVER_AUTH_HEADER, apiToken), secureConnection);
}

public static AccountApiClient getAccountApiClient(String apiToken) {
return new AccountApiClient(DEFAULTS.API_URL.value, getHeaders(DEFAULTS.ACOUNT_AUTH_HEADER, apiToken));
return new AccountApiClient(DEFAULTS.API_URL.value, getHeadersWithAuth(DEFAULTS.ACOUNT_AUTH_HEADER, apiToken));
}

public static AccountApiClient getAccountApiClient(String apiToken, Boolean secureConnection) {
return new AccountApiClient(DEFAULTS.API_URL.value, getHeaders(DEFAULTS.ACOUNT_AUTH_HEADER, apiToken), secureConnection);
return new AccountApiClient(DEFAULTS.API_URL.value, getHeadersWithAuth(DEFAULTS.ACOUNT_AUTH_HEADER, apiToken), secureConnection);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.io.IOException;

/**
* Client class acts as handler between HTTP requests handler class and class which provides endpoints to call.
* This class provides correct data for both sides and acts as controller.
* Client class acts as handler between HTTP requests handler class (HttpClient) and class which provides access to all endpoints to call.
* This class provides correct data for both sides and acts as controller. Also it verifies whether data sent and received is correct.
*/
public class HttpClientHandler {

Expand Down

0 comments on commit 3b7e6f1

Please sign in to comment.