Hi!
I've just started using HTTParty, and i've encountered a problem in the way it builds the Hash from the XML replied by the server.
If i setup the following Builder template on the server:
xml.thunt :sendSubscriptionResult, :"xmlns:thunt" => "http://example.com/thunt", :status => @status
everything works well, i.e. the Hash built by HTTParty matches the XML generated by Builder, (the latter can be observed by making the same request via curl):
curl Request
curl -s -H "Accept: text/xml" -d "xml=`cat vendor/testxml/requests/sendsubscription.xml`" $SERVER/${name}
Reply as seen by curl
'<thunt:sendSubscriptionResult xmlns:thunt="http://example.com/thunt" status="alreadySubscribed" />'
HTTParty request
TreasureHunt.post('/sendsubscription', :query => { :xml => sub } )
Reply in HTTParty
{"thunt:sendSubscriptionResult"=>{"status"=>"alreadySubscribed", "xmlns:thunt"=>"http://example.com/thunt"}}
But, if in the Builder i specify that i want the sendSubscriptionResult element to have a text node:
xml.thunt :sendSubscriptionResult, "Hello, World", :"xmlns:thunt" => "http://example.com/thunt", :status => @status
(note the "Hello, World" addition) the two tools suddenly disagree.
curl
'<thunt:sendSubscriptionResult xmlns:thunt="http://example.com/thunt" status="alreadySubscribed">Hello, World</thunt:sendSubscriptionResult>'
HTTParty
{"thunt:sendSubscriptionResult"=>"Hello, World"}
As you can see, HTTParty has stripped all of the element's attributes, and has put only the text node in the resulting Hash
Is this a bug in HTTParty or am I doing something wrong? Thanks!