Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Wrong documentation for creating LIDB #81

Open
3 of 5 tasks
danperes97 opened this issue Aug 19, 2024 · 0 comments
Open
3 of 5 tasks

[BUG] Wrong documentation for creating LIDB #81

danperes97 opened this issue Aug 19, 2024 · 0 comments
Labels

Comments

@danperes97
Copy link

danperes97 commented Aug 19, 2024

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)
@danperes97 danperes97 added the bug label Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant