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

Commit 2bb2aae

Browse files
mayitbeeghmelanahammel
and
melanahammel
authored
Replace empty string with a more readable constant (#71)
* Replace empty string with a more readable constant * chore: bump version Co-authored-by: melanahammel <[email protected]>
1 parent c1452b8 commit 2bb2aae

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
version=7.4.0
16+
version=7.4.3
1717
groupId=com.nike
1818
artifactId=cerberus-client

src/main/java/com/nike/cerberus/client/CerberusClient.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public class CerberusClient {
7878

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

81+
public static final String EMPTY_PATH = "";
82+
8183
public static final MediaType DEFAULT_MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8");
8284

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

362364
/**
@@ -380,7 +382,7 @@ public Map<CerberusRolePermission, String> getRolePermissionMap() {
380382
* @return List of all categories
381383
*/
382384
public List<CerberusCategoryResponse> listCategories() {
383-
return buildAndExecuteRequest(CATEGORY_PATH, "", HttpMethod.GET, null, new TypeToken<List<CerberusCategoryResponse>>(){}.getType());
385+
return buildAndExecuteRequest(CATEGORY_PATH, EMPTY_PATH, HttpMethod.GET, null, new TypeToken<List<CerberusCategoryResponse>>(){}.getType());
384386
}
385387

386388
/**
@@ -405,7 +407,7 @@ public Map<String, String> getCategoryMap() {
405407
* @return Map of category path to ID
406408
*/
407409
public String getCategoryIdByPath(String path) {
408-
return listCategories().stream().collect(Collectors.toMap(CerberusCategoryResponse::getPath, CerberusCategoryResponse::getId)).get(path);
410+
return getCategoryMap().get(path);
409411
}
410412

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

426428

@@ -466,7 +468,7 @@ public CerberusSafeDepositBoxResponse getSafeDepositBoxById(String id) {
466468
* @return The metadata of the created safe deposit box
467469
*/
468470
public CerberusSafeDepositBoxResponse createSafeDepositBox(CerberusSafeDepositBoxRequest cerberusSafeDepositBoxRequest) {
469-
return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, "", HttpMethod.POST, cerberusSafeDepositBoxRequest, CerberusSafeDepositBoxResponse.class);
471+
return buildAndExecuteRequest(SAFE_DEPOSIT_BOX_PREFIX, EMPTY_PATH, HttpMethod.POST, cerberusSafeDepositBoxRequest, CerberusSafeDepositBoxResponse.class);
470472
}
471473

472474

src/main/java/com/nike/cerberus/client/model/CerberusUserGroupPermission.java

-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,4 @@ public String getRoleId() {
3636
public void setRoleId(String roleId) {
3737
this.roleId = roleId;
3838
}
39-
40-
41-
4239
}

0 commit comments

Comments
 (0)