CruGlobal/mpdx — pull request #160 by draffensperger (2014-10-08 01:23:19+00:00)
Title: Google import fixes

These changes fix two Errbit-reported exceptions related to the Google import.

1. It's possible via the Google Contacts specification (https://developers.google.com/gdata/docs/2.0/elements#gdCountry) for an address's `country` to be blank but have a `code` value. (I'm guessing the actual cases were due to some sort of another program's import into Google Contacts or something as that case doesn't seem easy to create using the Google Contacts Gui). That was triggering an error as MPDX expected the `country` field to always be a string and not a hash (which it would be if it had a `code` sub-field). I updated the gem to deal with that case, and make the expectation that the `country` from the Google contacts be nil or string explicit in the code.

2. There was also an Errbit error for the case when the Google account login token needs to be refreshed. From the user's perspective the behavior of the import would have seemed correct, as they would have received an import failed email and also an email instructing them to refresh their account. However, from a developer perspective, the Errbit error is confusing as an account refresh is actually an expected condition over time, so I added a new error class `Import::UnsurprisingImportError` which triggers the failed import email, but doesn't re-raise (and hence log to Errbit) the exception.