use of no.stelar7.api.r4j.pojo.lol.staticdata.realm.Realm in project L4J8 by stelar7.
the class StaticTest method testRealms.
@Test
public void testRealms() {
DataCall.setCacheProvider(new FileSystemCacheProvider());
DataCall.setLogLevel(LogLevel.DEBUG);
Realm data = api.getRealm(Platform.EUW1);
}
use of no.stelar7.api.r4j.pojo.lol.staticdata.realm.Realm in project L4J8 by stelar7.
the class StaticAPI method getRealm.
public Realm getRealm(Platform server) {
DataCallBuilder builder = new DataCallBuilder().withEndpoint(URLEndpoint.V3_STATIC_REALMS).withURLData(Constants.URL_PARAM_DATA_BY_ID, String.valueOf(true)).withPlatform(server);
Optional chl = DataCall.getCacheProvider().get(URLEndpoint.V3_STATIC_REALMS, server);
if (chl.isPresent()) {
return (Realm) chl.get();
}
try {
Realm list = (Realm) builder.build();
DataCall.getCacheProvider().store(URLEndpoint.V3_STATIC_REALMS, list, server);
return list;
} catch (ClassCastException e) {
return null;
}
}
use of no.stelar7.api.r4j.pojo.lol.staticdata.realm.Realm in project L4J8 by stelar7.
the class StaticTest method testRealms.
@Test
public void testRealms() {
DataCall.setCacheProvider(new FileSystemCacheProvider());
Realm data = api.getRealm();
}
use of no.stelar7.api.r4j.pojo.lol.staticdata.realm.Realm in project L4J8 by stelar7.
the class ImageAPI method buildImageURL.
private String buildImageURL(@Nullable String version, String path, String file, @Nullable Platform rreg) {
Platform region = rreg;
if (region == null) {
region = Platform.EUW1;
}
Realm realm = StaticAPI.getInstance().getRealm(region);
String cdn = realm.getCDN();
String versionString = version != null ? version : realm.getV();
String preReplace = cdn + Constants.SEPARATOR + versionString + Constants.SEPARATOR + path + Constants.SEPARATOR + file;
return preReplace.replace(" ", "%20");
}
use of no.stelar7.api.r4j.pojo.lol.staticdata.realm.Realm in project L4J8 by stelar7.
the class DDragonAPI method getRealm.
public Realm getRealm(LeagueShard region) {
DataCallBuilder builder = new DataCallBuilder().withLimiters(false).withProxy(Constants.DDRAGON_PROXY).withURLParameter(Constants.REGION_PLACEHOLDER, region.getRealmValue()).withEndpoint(URLEndpoint.DDRAGON_REALMS);
Map<String, Object> data = new TreeMap<>();
data.put("platform", region);
Optional<?> chl = DataCall.getCacheProvider().get(URLEndpoint.DDRAGON_REALMS, data);
if (chl.isPresent()) {
return (Realm) chl.get();
}
try {
Realm list = (Realm) builder.build();
data.put("value", list);
DataCall.getCacheProvider().store(URLEndpoint.DDRAGON_REALMS, data);
return list;
} catch (ClassCastException e) {
return null;
}
}
Aggregations