Search in sources :

Example 1 with Realm

use of no.stelar7.api.l4j8.pojo.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);
}
Also used : FileSystemCacheProvider(no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider) Realm(no.stelar7.api.l4j8.pojo.staticdata.realm.Realm)

Example 2 with Realm

use of no.stelar7.api.l4j8.pojo.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;
    }
}
Also used : Realm(no.stelar7.api.l4j8.pojo.staticdata.realm.Realm)

Example 3 with Realm

use of no.stelar7.api.l4j8.pojo.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");
}
Also used : Realm(no.stelar7.api.l4j8.pojo.staticdata.realm.Realm)

Aggregations

Realm (no.stelar7.api.l4j8.pojo.staticdata.realm.Realm)3 FileSystemCacheProvider (no.stelar7.api.l4j8.basic.cache.impl.FileSystemCacheProvider)1