Skip to content

Commit

Permalink
Release/0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyand authored Nov 25, 2019
2 parents 7a2f995 + 5fa42d0 commit 30b9265
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.6.1 (2019-11-25)
--------------------------
Default isInEuropeanUnion to false in case of NoSuchMethodError (#123)

Version 0.6.0 (2019-11-21)
--------------------------
Add support for isInEuropeanUnion flag (#87)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ can also configure an LRU (Least Recently Used) cache of variable size

## Installation

The latest version of scala-maxmind-iplookups is **0.6.0** and is compatible with Scala 2.12.
The latest version of scala-maxmind-iplookups is **0.6.1** and is compatible with Scala 2.12.

Add this to your SBT config:

```scala
val maxmindIpLookups = "com.snowplowanalytics" %% "scala-maxmind-iplookups" % "0.6.0"
val maxmindIpLookups = "com.snowplowanalytics" %% "scala-maxmind-iplookups" % "0.6.1"
```

Retrieve the `GeoLite2-City.mmdb` file from the [MaxMind downloads page][maxmind-downloads]
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lazy val root = project
.settings(
organization := "com.snowplowanalytics",
name := "scala-maxmind-iplookups",
version := "0.6.0",
version := "0.6.1",
description := "Scala wrapper for MaxMind GeoIP2 library",
scalaVersion := "2.12.8",
javacOptions := BuildSettings.javaCompilerOptions,
Expand Down
12 changes: 10 additions & 2 deletions src/main/scala/com.snowplowanalytics.maxmind.iplookups/model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ object model {
* @param cityResponse MaxMind CityResponse object
* @return IpLocation
*/
def apply(cityResponse: CityResponse): IpLocation =
def apply(cityResponse: CityResponse): IpLocation = {
// Try to bypass bincompat problem with Spark Enrich,
// Delete once Spark Enrich is deprecated
val isInEuropeanUnion = try {
cityResponse.getCountry.isInEuropeanUnion
} catch {
case _: NoSuchMethodError => false
}
IpLocation(
countryCode = cityResponse.getCountry.getIsoCode,
countryName = cityResponse.getCountry.getName,
Expand All @@ -66,10 +73,11 @@ object model {
postalCode = Option(cityResponse.getPostal.getCode),
metroCode = Option(cityResponse.getLocation.getMetroCode).map(_.toInt),
regionName = Option(cityResponse.getMostSpecificSubdivision.getName),
isInEuropeanUnion = cityResponse.getCountry.isInEuropeanUnion,
isInEuropeanUnion = isInEuropeanUnion,
continent = cityResponse.getContinent.getName,
accuracyRadius = cityResponse.getLocation.getAccuracyRadius
)
}
}

/** Result of MaxMind lookups */
Expand Down

0 comments on commit 30b9265

Please sign in to comment.