Skip to content

Commit 8cec903

Browse files
committed
Use camel case
1 parent e4a59d6 commit 8cec903

File tree

7 files changed

+25
-21
lines changed

7 files changed

+25
-21
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
CHANGELOG
22
=========
3+
4.0.0 (2022-11-17)
4+
------------------
5+
6+
* Added support for ip risk database.
37

48
3.0.2 (2022-10-31)
59
------------------

src/main/java/com/maxmind/geoip2/DatabaseProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Optional<AnonymousIpResponse> tryAnonymousIp(InetAddress ipAddress) throws IOExc
5858
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
5959
* @throws java.io.IOException if there is an IO error
6060
*/
61-
IPRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
61+
IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
6262
GeoIp2Exception;
6363

6464
/**
@@ -69,7 +69,7 @@ IPRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
6969
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
7070
* @throws java.io.IOException if there is an IO error
7171
*/
72-
Optional<IPRiskResponse> tryIPRisk(InetAddress ipAddress) throws IOException,
72+
Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
7373
GeoIp2Exception;
7474

7575
/**

src/main/java/com/maxmind/geoip2/DatabaseReader.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,9 @@ private Optional<AnonymousIpResponse> getAnonymousIp(
422422
* @throws IOException if there is an IO error
423423
*/
424424
@Override
425-
public IPRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
425+
public IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
426426
GeoIp2Exception {
427-
Optional<IPRiskResponse> r = getIPRisk(ipAddress);
427+
Optional<IpRiskResponse> r = getIpRisk(ipAddress);
428428
if (r.isEmpty()) {
429429
throw new AddressNotFoundException("The address "
430430
+ ipAddress.getHostAddress() + " is not in the database.");
@@ -433,25 +433,25 @@ public IPRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
433433
}
434434

435435
@Override
436-
public Optional<IPRiskResponse> tryIPRisk(InetAddress ipAddress) throws IOException,
436+
public Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
437437
GeoIp2Exception {
438-
return getIPRisk(ipAddress);
438+
return getIpRisk(ipAddress);
439439
}
440440

441-
private Optional<IPRiskResponse> getIPRisk(
441+
private Optional<IpRiskResponse> getIpRisk(
442442
InetAddress ipAddress
443443
) throws IOException, GeoIp2Exception {
444-
LookupResult<IPRiskResponse> result = this.get(
444+
LookupResult<IpRiskResponse> result = this.get(
445445
ipAddress,
446-
IPRiskResponse.class,
446+
IpRiskResponse.class,
447447
DatabaseType.IP_RISK
448448
);
449-
IPRiskResponse response = result.getModel();
449+
IpRiskResponse response = result.getModel();
450450
if (response == null) {
451451
return Optional.empty();
452452
}
453453
return Optional.of(
454-
new IPRiskResponse(
454+
new IpRiskResponse(
455455
response,
456456
result.getIpAddress(),
457457
result.getNetwork()

src/main/java/com/maxmind/geoip2/model/AnonymousIpResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* This class provides the GeoIP2 Anonymous IP model.
1313
*/
14-
public class AnonymousIpResponse extends IPBaseResponse {
14+
public class AnonymousIpResponse extends IpBaseResponse {
1515

1616
public AnonymousIpResponse(
1717
@JacksonInject("ip_address") @JsonProperty("ip_address") String ipAddress,

src/main/java/com/maxmind/geoip2/model/IPBaseResponse.java renamed to src/main/java/com/maxmind/geoip2/model/IpBaseResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* This class provides the base IP model.
1010
*/
11-
public class IPBaseResponse extends AbstractResponse {
11+
public class IpBaseResponse extends AbstractResponse {
1212

1313
private final boolean isAnonymous;
1414
private final boolean isAnonymousVpn;
@@ -19,7 +19,7 @@ public class IPBaseResponse extends AbstractResponse {
1919
private final String ipAddress;
2020
private final Network network;
2121

22-
public IPBaseResponse(
22+
public IpBaseResponse(
2323
String ipAddress,
2424
boolean isAnonymous,
2525
boolean isAnonymousVpn,

src/main/java/com/maxmind/geoip2/model/IPRiskResponse.java renamed to src/main/java/com/maxmind/geoip2/model/IpRiskResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
/**
1212
* This class provides the GeoIP2 IP Risk model.
1313
*/
14-
public class IPRiskResponse extends IPBaseResponse {
14+
public class IpRiskResponse extends IpBaseResponse {
1515

1616
private final float ipRisk;
1717

18-
public IPRiskResponse (
18+
public IpRiskResponse (
1919
@JacksonInject("ip_address") @JsonProperty("ip_address") String ipAddress,
2020
@JsonProperty("is_anonymous") boolean isAnonymous,
2121
@JsonProperty("is_anonymous_vpn") boolean isAnonymousVpn,
@@ -31,7 +31,7 @@ public IPRiskResponse (
3131
}
3232

3333
@MaxMindDbConstructor
34-
public IPRiskResponse(
34+
public IpRiskResponse(
3535
@MaxMindDbParameter(name = "ip_address") String ipAddress,
3636
@MaxMindDbParameter(name = "is_anonymous") Boolean isAnonymous,
3737
@MaxMindDbParameter(name = "is_anonymous_vpn") Boolean isAnonymousVpn,
@@ -57,8 +57,8 @@ public IPRiskResponse(
5757
);
5858
}
5959

60-
public IPRiskResponse(
61-
IPRiskResponse response,
60+
public IpRiskResponse(
61+
IpRiskResponse response,
6262
String ipAddress,
6363
Network network
6464
) {

src/test/java/com/maxmind/geoip2/DatabaseReaderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public void testIPRisk() throws Exception {
221221
this.getFile("GeoIP2-IP-Risk-Test.mmdb")).build()
222222
) {
223223
InetAddress ipAddress = InetAddress.getByName("0000:0000:0000:0000:0000:0000:D602:0300");
224-
IPRiskResponse response = reader.ipRisk(ipAddress);
224+
IpRiskResponse response = reader.ipRisk(ipAddress);
225225
assertTrue(response.isAnonymous());
226226
assertTrue(response.isAnonymousVpn());
227227
assertFalse(response.isHostingProvider());
@@ -231,7 +231,7 @@ public void testIPRisk() throws Exception {
231231
assertEquals(ipAddress.getHostAddress(), response.getIpAddress());
232232
assertEquals(0.1,response.getIPRisk(), 0.0001);
233233
assertEquals("0:0:0:0:0:0:d602:300/126", response.getNetwork().toString());
234-
IPRiskResponse tryResponse = reader.tryIPRisk(ipAddress).get();
234+
IpRiskResponse tryResponse = reader.tryIpRisk(ipAddress).get();
235235
assertEquals(response.toJson(), tryResponse.toJson());
236236
}
237237
}

0 commit comments

Comments
 (0)