From 3b7e6f1c394ab45e76365079795f649cb58bdc3d Mon Sep 17 00:00:00 2001 From: Igor Balos Date: Mon, 20 Nov 2017 10:22:53 +0100 Subject: [PATCH] made headers retrieval method bit clear er --- .../java/com/wildbit/java/postmark/Postmark.java | 14 +++++++------- .../java/postmark/client/HttpClientHandler.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/wildbit/java/postmark/Postmark.java b/src/main/java/com/wildbit/java/postmark/Postmark.java index 0be11f3..a767ea5 100644 --- a/src/main/java/com/wildbit/java/postmark/Postmark.java +++ b/src/main/java/com/wildbit/java/postmark/Postmark.java @@ -14,7 +14,7 @@ public class Postmark { /** - * Base Application Constants + * Base Postmark APP Constants */ public enum DEFAULTS { API_URL("api.postmarkapp.com"), @@ -43,7 +43,7 @@ public static MultivaluedHashMap 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; @@ -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); } } diff --git a/src/main/java/com/wildbit/java/postmark/client/HttpClientHandler.java b/src/main/java/com/wildbit/java/postmark/client/HttpClientHandler.java index 7bc45b1..7ddb1be 100644 --- a/src/main/java/com/wildbit/java/postmark/client/HttpClientHandler.java +++ b/src/main/java/com/wildbit/java/postmark/client/HttpClientHandler.java @@ -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 {