Sibling elements under parent array
Closed this issue · 1 comments
ruckus commented
Not sure if the title is accurate :( I'm trying to generate XML like:
<EstimateQueryRq iterator="Start">
<MaxReturned>50</MaxReturned>
<EntityFilter>
<ListID>80000042-1424746827</ListID>
<ListID>8000001B-1407979267</ListID>
</EntityFilter>
<IncludeLineItems>true</IncludeLineItems>
<OwnerID>0</OwnerID>
</EstimateQueryRq>
My hash is:
{
"max_returned"=>50,
"xml_attributes"=>{"iterator"=>"Start"},
"EntityFilter"=>[{"list_id"=>"80000042-1424746827"}, {"list_id"=>"8000001B-1407979267"}],
"include_line_items"=>true,
"OwnerID"=>0
}
So EntityFilter
is an array of two elements.
But the library is actually producing this XML:
<EstimateQueryRq iterator="Start">
<MaxReturned>50</MaxReturned>
<EntityFilter>
<ListID>80000042-1424746827</ListID>
</EntityFilter>
<EntityFilter>
<ListID>8000001B-1407979267</ListID>
</EntityFilter>
<IncludeLineItems>true</IncludeLineItems>
<OwnerID>0</OwnerID>
</EstimateQueryRq>
Notice the duplication of the EntityFilter
element.
Do I need to restructure my hash? Any guidance would be appreciated.
Thanks!
ruckus commented
Answered my own question. Yes, the hash needs to be restructured like:
{
"max_returned"=>50,
"xml_attributes"=>{"iterator"=>"Start"},
"EntityFilter"=>{
"list_id"=>["80000042-1424746827", "8000001B-1407979267"]
},
"include_line_items"=>true,
"OwnerID"=>0
}