Last active
October 27, 2020 14:42
-
-
Save deenar/c037b2abd9ec0172adbe7628c9bbfbe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Address ( | |
label: Option[String], | |
countryCode: Option[String], | |
countryName: Option[String], | |
stateCode: Option[String], | |
state: Option[String], | |
countyCode: Option[String], | |
county: Option[String], | |
city: Option[String], | |
district: Option[String], | |
subdistrict: Option[String], | |
street: Option[String], | |
block: Option[String], | |
subblock: Option[String], | |
postalCode: Option[String], | |
houseNumber: Option[String] | |
) | |
case class HereResponse (title: String, id: String, address: Address ) | |
case class HereResponseList (items: Seq[HereResponse]) | |
case class PostalAddress24(AdrTp: Option[common.AddressType3Choice] = None, | |
Dept: Option[String] = None, | |
SubDept: Option[String] = None, | |
StrtNm: Option[String] = None, | |
BldgNb: Option[String] = None, | |
BldgNm: Option[String] = None, | |
Flr: Option[String] = None, | |
PstBx: Option[String] = None, | |
Room: Option[String] = None, | |
PstCd: Option[String] = None, | |
TwnNm: Option[String] = None, | |
TwnLctnNm: Option[String] = None, | |
DstrctNm: Option[String] = None, | |
CtrySubDvsn: Option[String] = None, | |
Ctry: Option[String] = None, | |
AdrLine: List[String] = Nil) | |
def addressOps(hereAddress:Address) : PostalAddress24 = | |
PostalAddress24( | |
Ctry=hereAddress.countryCode.map(_.take(2)), | |
CtrySubDvsn=hereAddress.stateCode, // or State | |
DstrctNm=hereAddress.district, | |
TwnLctnNm=hereAddress.subdistrict, | |
TwnNm=hereAddress.city, | |
PstCd=hereAddress.postalCode, | |
BldgNm=hereAddress.houseNumber, | |
StrtNm=hereAddress.street) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment