Add more MaxMind results
This commit is contained in:
parent
3de5e8d756
commit
6eeb153413
@ -16,12 +16,12 @@ public final class MaxMindLocation {
|
|||||||
public MaxMindLocation() {} // For Jackson
|
public MaxMindLocation() {} // For Jackson
|
||||||
|
|
||||||
public MaxMindLocation(JsonObject legacy) {
|
public MaxMindLocation(JsonObject legacy) {
|
||||||
this.latitude = legacy.getDouble("latitude");
|
this.latitude = legacy.getDouble("latitude", -1D);
|
||||||
this.longitude = legacy.getDouble("longitude");
|
this.longitude = legacy.getDouble("longitude", -1D);
|
||||||
this.accuracyRadius = legacy.getInteger("accuracy_radius");
|
this.accuracyRadius = legacy.getInteger("accuracy_radius", -1);
|
||||||
this.timeZone = legacy.getString("time_zone");
|
this.timeZone = legacy.getString("time_zone", "");
|
||||||
this.populationDensity = legacy.getInteger("population_density", -1);
|
this.populationDensity = legacy.getInteger("population_density", -1);
|
||||||
this.metroCode = legacy.getInteger("metro_code", -1); // Metro codes are US only
|
this.metroCode = legacy.getInteger("metro_code", -1);
|
||||||
this.averageIncome = legacy.getInteger("average_income", -1);
|
this.averageIncome = legacy.getInteger("average_income", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.frozenorb.apiv3.maxmind;
|
package net.frozenorb.apiv3.maxmind;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import io.vertx.core.json.JsonArray;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ public final class MaxMindResult {
|
|||||||
|
|
||||||
List<MaxMindSubdivision> subdivisions = new LinkedList<>();
|
List<MaxMindSubdivision> subdivisions = new LinkedList<>();
|
||||||
|
|
||||||
for (Object subdivision : legacy.getJsonArray("subdivisions")) {
|
for (Object subdivision : legacy.getJsonArray("subdivisions", new JsonArray())) {
|
||||||
subdivisions.add(new MaxMindSubdivision((JsonObject) subdivision));
|
subdivisions.add(new MaxMindSubdivision((JsonObject) subdivision));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public final class MaxMindTraits {
|
|||||||
this.domain = legacy.getString("domain", "");
|
this.domain = legacy.getString("domain", "");
|
||||||
this.asn = legacy.getInteger("autonomous_system_number", -1);
|
this.asn = legacy.getInteger("autonomous_system_number", -1);
|
||||||
this.asnOrganization = legacy.getString("autonomous_system_organization" , "");
|
this.asnOrganization = legacy.getString("autonomous_system_organization" , "");
|
||||||
this.userType = MaxMindUserType.valueOf(legacy.getString("user_type", "").toUpperCase());
|
this.userType = legacy.containsKey("user_type") ? MaxMindUserType.valueOf(legacy.getString("user_type").toUpperCase()) : MaxMindUserType.UNKNOWN;
|
||||||
this.organization = legacy.getString("organization", "");
|
this.organization = legacy.getString("organization", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ public enum MaxMindUserType {
|
|||||||
ROUTER(true),
|
ROUTER(true),
|
||||||
SCHOOL(true),
|
SCHOOL(true),
|
||||||
SEARCH_ENGINE_SPIDER(false),
|
SEARCH_ENGINE_SPIDER(false),
|
||||||
TRAVELER(true);
|
TRAVELER(true),
|
||||||
|
UNKNOWN(true);
|
||||||
|
|
||||||
@Getter private boolean allowed;
|
@Getter private boolean allowed;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user