-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Checklist
- Have you provided a description of the bug?
- Have you provided your Environment information? - Doesn't apply here
- Have you provided a sample code snippet?
- Have you provided a stack trace? - Doesn't apply here
- Have you outlined the expected behavior?
Description
The issue arises from a discrepancy in the Bandwidth Iris SDK documentation. When creating an LIDB order, the documentation provides the following structure:
data = {
:customer_order_id => "A test order",
:lidb_tn_groups => {
:lidb_tn_group => {
:telephone_numbers => ["8048030097", "8045030098"], # this is the issue
:subscriber_information => "Joes Grarage", # typo here
:use_type => "RESIDENTIAL",
:visibility => "PUBLIC"
}
}
}
BandwidthIris::Lidb.create(data)However, this structure generates the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<LidbOrder>
<CustomerOrderId>A test order</CustomerOrderId>
<LidbTnGroups>
<LidbTnGroup>
<TelephoneNumbers>
8048030097
</TelephoneNumbers>
<TelephoneNumbers>
8045030098
</TelephoneNumbers>
<SubscriberInformation>Joes Grarage</SubscriberInformation>
<UseType>RESIDENTIAL</UseType>
<Visibility>PUBLIC</Visibility>
</LidbTnGroup>
</LidbTnGroups>
</LidbOrder>This results in a Bad Request error:
Status Code: 400
Reason:
HTTP Headers: { ... }
Response Body: {:response_status=>{:error_code=>1003, :description=>"TelephoneNumbers is required"}}The problem seems to be that the documentation incorrectly suggests using a plain array for telephone numbers, which leads to the SDK generating invalid XML. Additionally, there's a typo in the subscriber_information field ("Joes Grarage" instead of "Joes Garage").
Link to the documentation: https://github.com/Bandwidth/ruby-bandwidth-iris?tab=readme-ov-file#create
Expected Behavior
Creates a valid LIDB order XML according to the Bandwidth documentation website: https://dev.bandwidth.com/docs/numbers/guides/manageNumberFeatures/#calling-name-display-update-lidb
Suggested Fix
After testing in my application, the following structure works correctly:
data = {
:customer_order_id => "A test order",
:lidb_tn_groups => {
:lidb_tn_group => {
:telephone_numbers => [
{ telephone_number: "8048030097" },
{ telephone_number: "8045030098" }
},
:subscriber_information => "Joes Garage",
:use_type => "RESIDENTIAL",
:visibility => "PUBLIC"
}
}
}
BandwidthIris::Lidb.create(data)