Skip to content

Conversation

@quinncomendant
Copy link
Contributor

Nexmo's API is inconsistent when dealing with edge cases. I've had to relax the validation to avoid throwing exceptions during perfectly valid API responses.

  • In Account/Numbers.php, if the account has no numbers attached, the 'count' will be zero and further validation would fail. Here we just exit validation if the count is zero.
  • In Account/Numbers.php, the 'moHttpUrl' value may not exist if a number has been added without one (in which case the account's default moHttpUrl will be used). We cannot expect this value to exist.
  • In Account/Pricing/Country.php the country parameter should always be uppercase (Nexmo will error if it is not).
  • In Account/Pricing/Country.php, some countries do not have a 'mt' price value set (e.g., BV) so we can't expect it.

…relax the validation to avoid throwing exceptions during perfectly valid API responses.

* In Account/Numbers.php we end validation if the count is zero, which can occur if the account has no numbers attached. Also, removed the validation for moHttpUrl because this value may not exist if a number has been added without one (in which case the account's default moHttpUrl will be used).
* In Account/Pricing/Country.php the country parameter should always be uppercase (Nexmo will error if it is not). Also, some countries to not have a 'mt' price value set (e.g., BV) so we can't freak out if it is missing.
@vood
Copy link
Contributor

vood commented Sep 8, 2015

Please check unit test failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants