Skip to content

Commit

Permalink
Updated to support the latest team and league resources. Also cleaned…
Browse files Browse the repository at this point in the history
… up some code and removed a lot of tests that are now redundant.
  • Loading branch information
aaryn101 committed May 17, 2014
1 parent 46c53bd commit dafb9cb
Show file tree
Hide file tree
Showing 30 changed files with 647 additions and 687 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'java'
apply plugin: 'jacoco'

sourceCompatibility = 1.7
version = '2.0'
version = '2.1'

repositories {
mavenCentral()
Expand Down
54 changes: 46 additions & 8 deletions src/main/java/lol4j/client/impl/Lol4JClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import lol4j.protocol.dto.champion.ChampionDto;
import lol4j.protocol.dto.game.RecentGamesDto;
import lol4j.protocol.dto.league.LeagueDto;
import lol4j.protocol.dto.league.LeagueItemDto;
import lol4j.protocol.dto.league.LeagueEntryDto;
import lol4j.protocol.dto.lolstaticdata.*;
import lol4j.protocol.dto.stats.PlayerStatsSummaryListDto;
import lol4j.protocol.dto.stats.RankedStatsDto;
Expand All @@ -31,6 +31,7 @@ public class Lol4JClientImpl implements Lol4JClient {
private static final String PROD_BASE = "https://prod.api.pvp.net/api/lol";
private static final String EU_BASE = "https://eu.api.pvp.net/api/lol";
private static final String ASIA_BASE = "https://asia.api.pvp.net/api/lol";
private static final String STATIC_DATA_BASE = "https://prod.api.pvp.net/api/lol/static-data";
private ChampionResource championResource;
private GameResource gameResource;
private LeagueResource leagueResource;
Expand All @@ -46,7 +47,8 @@ public Lol4JClientImpl(String apiKey) {
prodApiRequestManager = new ApiRequestManager(apiKey, PROD_BASE);
euApiRequestManager = new ApiRequestManager(apiKey, EU_BASE);
asiaApiRequestManager = new ApiRequestManager(apiKey, ASIA_BASE);
ResourceFactory resourceFactory = new ResourceFactory(prodApiRequestManager, euApiRequestManager, asiaApiRequestManager);
ApiRequestManager staticDataApiRequestManager = new ApiRequestManager(apiKey, STATIC_DATA_BASE);
ResourceFactory resourceFactory = new ResourceFactory(prodApiRequestManager, euApiRequestManager, asiaApiRequestManager, staticDataApiRequestManager);

championResource = resourceFactory.createChampionResource();
gameResource = resourceFactory.createGameResource();
Expand Down Expand Up @@ -83,13 +85,38 @@ public List<LeagueDto> getLeaguesData(long summonerId, Region region) {
}

@Override
public List<LeagueItemDto> getLeaguesEntryData(long summonerId, Region region) {
public Map<String, List<LeagueDto>> getLeaguesData(List<Long> summonerIds, Region region) {
return leagueResource.getLeaguesData(summonerIds, region);
}

@Override
public List<LeagueEntryDto> getLeaguesEntryData(long summonerId, Region region) {
return leagueResource.getLeaguesEntryData(summonerId, region);
}

@Override
public PlayerStatsSummaryListDto getPlayerStatsSummaries(long summonerId, Region region, Season season) {
return statsResource.getPlayerStatsSummaries(summonerId, region, season);
public Map<String, List<LeagueEntryDto>> getLeaguesEntryData(List<Long> summonerIds, Region region) {
return leagueResource.getLeaguesEntryData(summonerIds, region);
}

@Override
public List<LeagueDto> getLeaguesDataByTeam(String teamId, Region region) {
return leagueResource.getLeaguesDataByTeam(teamId, region);
}

@Override
public Map<String, List<LeagueDto>> getLeaguesDataByTeam(List<String> teamIds, Region region) {
return leagueResource.getLeaguesDataByTeam(teamIds, region);
}

@Override
public List<LeagueEntryDto> getLeaguesEntryDataByTeam(String teamId, Region region) {
return leagueResource.getLeaguesEntryDataByTeam(teamId, region);
}

@Override
public Map<String, List<LeagueEntryDto>> getLeaguesEntryDataByTeam(List<String> teamIds, Region region) {
return leagueResource.getLeaguesEntryDataByTeam(teamIds, region);
}

@Override
Expand All @@ -102,6 +129,11 @@ public Map<String, MasteryPagesDto> getMasteryPages(List<Long> summonerIds, Regi
return summonerResource.getMasteryPages(summonerIds, region);
}

@Override
public PlayerStatsSummaryListDto getPlayerStatsSummaries(long summonerId, Region region, Season season) {
return statsResource.getPlayerStatsSummaries(summonerId, region, season);
}

@Override
public MasteryPagesDto getMasteryPages(long summonerId, Region region) {
return summonerResource.getMasteryPages(summonerId, region);
Expand Down Expand Up @@ -148,8 +180,13 @@ public String getSummonerName(long summonerId, Region region) {
}

@Override
public List<TeamDto> getTeams(long summonerId, Region region) {
return teamResource.getTeams(summonerId, region);
public List<TeamDto> getTeamsBySummonerId(long summonerId, Region region) {
return teamResource.getTeamsBySummonerId(summonerId, region);
}

@Override
public Map<String, List<TeamDto>> getTeamsBySummonerId(List<Long> summonerIds, Region region) {
return teamResource.getTeamsBySummonerId(summonerIds, region);
}

@Override
Expand Down Expand Up @@ -213,13 +250,14 @@ public SummonerSpellListDto getSummonerSpellList(Region region, String locale, S
}

@Override
public SummonerSpellDto getSummonerSpell(String id, Region region, String locale, String version, List<SummonerSpellData> requestedData) {
public SummonerSpellDto getSummonerSpell(int id, Region region, String locale, String version, List<SummonerSpellData> requestedData) {
return lolStaticDataResource.getSummonerSpell(id, region, locale, version, requestedData);
}

@Override
public void setRateLimit(int perTenSeconds, int perTenMinutes) {
prodApiRequestManager.setRateLimit(perTenSeconds, perTenMinutes);
euApiRequestManager.setRateLimit(perTenSeconds, perTenMinutes);
asiaApiRequestManager.setRateLimit(perTenSeconds, perTenMinutes);
}
}
14 changes: 7 additions & 7 deletions src/main/java/lol4j/protocol/dto/league/LeagueDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class LeagueDto {
private List<LeagueItemDto> entries = new ArrayList<>();
private List<LeagueEntryDto> entries = new ArrayList<>();
private String name;
private Queue queue;
private Tier tier;
private long timestamp;
private String participantId;

public List<LeagueItemDto> getEntries() {
public List<LeagueEntryDto> getEntries() {
return entries;
}

Expand Down Expand Up @@ -46,11 +46,11 @@ public void setTier(Tier tier) {
this.tier = tier;
}

public long getTimestamp() {
return timestamp;
public String getParticipantId() {
return participantId;
}

public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
public void setParticipantId(String participantId) {
this.participantId = participantId;
}
}
101 changes: 101 additions & 0 deletions src/main/java/lol4j/protocol/dto/league/LeagueEntryDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package lol4j.protocol.dto.league;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Created by Aaron Corley on 12/11/13.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class LeagueEntryDto {
private String division;
private boolean isFreshBlood;
private boolean isHotStreak;
private boolean isInactive;
private boolean isVeteran;
private int leaguePoints;
private MiniSeriesDto miniSeries;
private String playerOrTeamId;
private String playerOrTeamName;
private int wins;

public String getDivision() {
return division;
}

public void setDivision(String division) {
this.division = division;
}

public boolean isFreshBlood() {
return isFreshBlood;
}

public void setFreshBlood(boolean isFreshBlood) {
this.isFreshBlood = isFreshBlood;
}

public boolean isHotStreak() {
return isHotStreak;
}

public void setHotStreak(boolean isHotStreak) {
this.isHotStreak = isHotStreak;
}

public boolean isInactive() {
return isInactive;
}

public void setInactive(boolean isInactive) {
this.isInactive = isInactive;
}

public boolean isVeteran() {
return isVeteran;
}

public void setVeteran(boolean isVeteran) {
this.isVeteran = isVeteran;
}

public int getLeaguePoints() {
return leaguePoints;
}

public void setLeaguePoints(int leaguePoints) {
this.leaguePoints = leaguePoints;
}

public MiniSeriesDto getMiniSeries() {
return miniSeries;
}

public void setMiniSeries(MiniSeriesDto miniSeries) {
this.miniSeries = miniSeries;
}

public String getPlayerOrTeamId() {
return playerOrTeamId;
}

public void setPlayerOrTeamId(String playerOrTeamId) {
this.playerOrTeamId = playerOrTeamId;
}

public String getPlayerOrTeamName() {
return playerOrTeamName;
}

public void setPlayerOrTeamName(String playerOrTeamName) {
this.playerOrTeamName = playerOrTeamName;
}

public int getWins() {
return wins;
}

public void setWins(int wins) {
this.wins = wins;
}
}
141 changes: 0 additions & 141 deletions src/main/java/lol4j/protocol/dto/league/LeagueItemDto.java

This file was deleted.

Loading

0 comments on commit dafb9cb

Please sign in to comment.