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

Commit

Permalink
Replace empty string with a more readable constant (#71)
Browse files Browse the repository at this point in the history
* Replace empty string with a more readable constant

* chore: bump version

Co-authored-by: melanahammel <[email protected]>
  • Loading branch information
mayitbeegh and melanahammel authored Feb 24, 2021
1 parent c1452b8 commit 2bb2aae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
version=7.4.0
version=7.4.3
groupId=com.nike
artifactId=cerberus-client
12 changes: 7 additions & 5 deletions src/main/java/com/nike/cerberus/client/CerberusClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public class CerberusClient {

public static final String SECURE_FILE_PATH_PREFIX = "v1/secure-file/";

public static final String EMPTY_PATH = "";

public static final MediaType DEFAULT_MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8");

protected static final int DEFAULT_NUM_RETRIES = 3;
Expand Down Expand Up @@ -356,7 +358,7 @@ public void delete(final String path) {
* @return List of all roles
*/
public List<CerberusRoleResponse> listRoles() {
return buildAndExecuteRequest(ROLE_PATH, "", HttpMethod.GET, null, new TypeToken<List<CerberusRoleResponse>>(){}.getType());
return buildAndExecuteRequest(ROLE_PATH, EMPTY_PATH, HttpMethod.GET, null, new TypeToken<List<CerberusRoleResponse>>(){}.getType());
}

/**
Expand All @@ -380,7 +382,7 @@ public Map<CerberusRolePermission, String> getRolePermissionMap() {
* @return List of all categories
*/
public List<CerberusCategoryResponse> listCategories() {
return buildAndExecuteRequest(CATEGORY_PATH, "", HttpMethod.GET, null, new TypeToken<List<CerberusCategoryResponse>>(){}.getType());
return buildAndExecuteRequest(CATEGORY_PATH, EMPTY_PATH, HttpMethod.GET, null, new TypeToken<List<CerberusCategoryResponse>>(){}.getType());
}

/**
Expand All @@ -405,7 +407,7 @@ public Map<String, String> getCategoryMap() {
* @return Map of category path to ID
*/
public String getCategoryIdByPath(String path) {
return listCategories().stream().collect(Collectors.toMap(CerberusCategoryResponse::getPath, CerberusCategoryResponse::getId)).get(path);
return getCategoryMap().get(path);
}

/**
Expand All @@ -420,7 +422,7 @@ public String getCategoryIdByPath(String path) {
* @return List of safe deposit box summaries
*/
public List<CerberusSafeDepositBoxSummaryResponse> listSafeDepositBoxes() {
return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, "", HttpMethod.GET, null, new TypeToken<List<CerberusSafeDepositBoxSummaryResponse>>(){}.getType());
return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, EMPTY_PATH, HttpMethod.GET, null, new TypeToken<List<CerberusSafeDepositBoxSummaryResponse>>(){}.getType());
}


Expand Down Expand Up @@ -466,7 +468,7 @@ public CerberusSafeDepositBoxResponse getSafeDepositBoxById(String id) {
* @return The metadata of the created safe deposit box
*/
public CerberusSafeDepositBoxResponse createSafeDepositBox(CerberusSafeDepositBoxRequest cerberusSafeDepositBoxRequest) {
return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, "", HttpMethod.POST, cerberusSafeDepositBoxRequest, CerberusSafeDepositBoxResponse.class);
return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, EMPTY_PATH, HttpMethod.POST, cerberusSafeDepositBoxRequest, CerberusSafeDepositBoxResponse.class);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,4 @@ public String getRoleId() {
public void setRoleId(String roleId) {
this.roleId = roleId;
}



}

0 comments on commit 2bb2aae

Please sign in to comment.