Convert Python sample code to Ruby

Hi,
Can some one conver the following sample code to RUBY please?
Many Thanks.

import urllib
import urllib2
from xml.dom import minidom

user=“YourUserName”
password=“YourPassword”

site=‘https://test.api.betfairgames.com/rest/v1/bet/order
site=site+"?username="+user

xml_request1="""

BACK
2.6
4
658439

“”"

values = {‘xmlRequest’:xml_request}
data=urllib.urlencode(values)

req=urllib2.Request(site)
req.add_header(‘Content-Type’, ‘application/x-www-form-urlencoded’)
req.add_header(‘gamexAPIAgent’,‘[email protected]’)
req.add_header(‘gamexAPIAgentInstance’,‘0d69ee8290ee2f9b336c1f060e3497a5’)
req.add_header(‘gamexAPIPassword’,password)
req.add_header(‘Keep-Alive’,‘300’)
req.add_header(‘Proxy-Connection’,‘keep-alive’)
req.add_header(‘Content-Type’,‘application/x-www-form-urlencoded’)
req.add_header(‘Content-Length’,str(len(data)))
req.add_data(data)

xmlresult = urllib2.urlopen(req)
xmlparser = minidom.parse(xmlresult)

print xmlparser.toxml()

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs