Skip to content

Commit

Permalink
Add support for isInEuropeanUnion flag (closes #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragisa Krsmanovic authored and BenFradet committed Jun 30, 2018
1 parent c4155a7 commit 61ef850
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ case class IpLocation(
timezone: Option[String],
postalCode: Option[String],
metroCode: Option[Int],
regionName: Option[String]
regionName: Option[String],
isInEuropeanUnion: Boolean
)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ object model {
timezone: Option[String],
postalCode: Option[String],
metroCode: Option[Int],
regionName: Option[String]
regionName: Option[String],
isInEuropeanUnion: Boolean
)

/** Companion class contains a constructor which takes a MaxMind CityResponse. */
Expand All @@ -49,7 +50,8 @@ object model {
timezone = Option(cityResponse.getLocation.getTimeZone),
postalCode = Option(cityResponse.getPostal.getCode),
metroCode = Option(cityResponse.getLocation.getMetroCode).map(_.toInt),
regionName = Option(cityResponse.getMostSpecificSubdivision.getName)
regionName = Option(cityResponse.getMostSpecificSubdivision.getName),
isInEuropeanUnion = cityResponse.getCountry.isInEuropeanUnion
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ object IpLookupsTest {
timezone = Some("Asia/Harbin"),
postalCode = None,
metroCode = None,
regionName = Some("Jilin Sheng")
regionName = Some("Jilin Sheng"),
isInEuropeanUnion = false
).asRight.some,
new AddressNotFoundException("The address 175.16.199.0 is not in the database.").asLeft.some,
new AddressNotFoundException("The address 175.16.199.0 is not in the database.").asLeft.some,
Expand All @@ -73,7 +74,8 @@ object IpLookupsTest {
timezone = Some("America/Los_Angeles"),
postalCode = Some("98354"),
metroCode = Some(819),
regionName = Some("Washington")
regionName = Some("Washington"),
isInEuropeanUnion = false
).asRight.some,
"Century Link".asRight.some,
"Lariat Software".asRight.some,
Expand All @@ -91,7 +93,8 @@ object IpLookupsTest {
timezone = Some("Asia/Thimphu"),
postalCode = None,
metroCode = None,
regionName = None
regionName = None,
isInEuropeanUnion = false
).asRight.some,
"Loud Packet".asRight.some,
"zudoarichikito_".asRight.some,
Expand Down

0 comments on commit 61ef850

Please sign in to comment.