Bandwidth / node-numbers

Node SDK for Bandwidth Numbers
https://dev.bandwidth.com
MIT License
1 stars 5 forks source link

Make `TnOption.create()` invoke its callback #40

Closed noahsilas closed 3 years ago

noahsilas commented 3 years ago

The response coming back from this endpoint has a different shape than the TnOption.get() - it is wrapped in a <TnOptionOrderResponse> element. That element doesn't have any direct TnOptionGroups children, and so this method was throwing when trying to iterate over an undefined attribute (in item.tnOptionGroups.forEach(...)).

Adjusting the tests to use an XML response that matches the API documentation demonstrates the failure well: the tests time out, because the thrown error prevents the callback from firing.

The package documentation suggests that the shape of this response should match TnOption.get(), which we can achieve by just unwrapping the contents from that outermost <TnOptionOrderResponse> element.

noahsilas commented 3 years ago

Unrelated aside: it would be awesome if it was possible to deep link into https://dev.bandwidth.com/numbers/apiReference.html so I could link directly to the "Response" tab under the POST /accounts/{accountId}/tnoptions endpoint (or even just that endpoint specifically)

ajrice6713 commented 3 years ago

Hey @noahsilas,

Taking a look at this today

as for deep linking to docs in the API reference - as soon as we have an Open API spec for that service (Soon, fingers crossed) we will generate new API documentation with deep linking that will look similar to this.