Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final String SUMMONER_DETAILS_TEMPLATE = "/api/lol/{region}/v1.4/summoner/by-name/{summonerName}";
- @Override
- public CompletableFuture<Summoner> getSummoner(String region, String summonerName) {
- return CompletableFuture.supplyAsync(() -> {
- String uriPath = SUMMONER_DETAILS_TEMPLATE.replace("{region}", region.toLowerCase());
- uriPath = uriPath.replace("{summonerName}", summonerName.toLowerCase().replaceAll("%s", ""));
- String completedUrl = getLocationForRegion(region) + uriPath;
- try {
- String json = prepareAndIssueRequest(completedUrl);
- HashMap response = OBJECT_MAPPER.readValue(json, HashMap.class);
- return OBJECT_MAPPER.convertValue(getSummonerFromResponse(response, summonerName), Summoner.class);
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement