qbwc / qbxml

QBXML Parser and Validation Tool
MIT License
27 stars 41 forks source link

Use consistent types in xml_to_hash #17

Closed JasonBarnabe closed 8 years ago

JasonBarnabe commented 8 years ago

Migrated from https://github.com/qbwc/qbwc/issues/52

You query for customers 100 at a time and you have 101 customers in QB. On the first handle_response call, r['customer_ret'] will be an array of 100 customers. On the second call, it will be a hash of a single customer. This sucks to handle - it should always be an array.

One way to implement may be to look for a comment containing "may rep" in the schema in a similar way we currently look up the type - https://github.com/qbwc/qbxml/blob/master/lib/qbxml/hash.rb#L140

JasonBarnabe commented 8 years ago

The branch single-element-array has a potential fix. It works for the one unit test I wrote, but I would like to get some testing done in real-world situations.