use the below:
#!/usr/bin/env ruby
require 'net/http'
require 'base64'
uri = URI.parse('http://www.google.com')
req = Net::HTTP.new(uri.hostname, uri.port)
xml_data = %{<?xml version="1.0" encoding="UTF-8"?>
<spa:data xmlns:spa="http://www.Sparrow.com/" object="Sparrow.PropertyList.1">
<spa:proplist>
<spa:propval name="username">jer</spa:propval>
</spa:proplist>
</spa:data>}
user_and_pass = username + ':' + password #replace username and password with your username and password as strings
base64user_and_pass = Base64.encode64(user_and_pass)
res = req.post(uri.path, xml_data, {'Content-Type' => 'text/xml', 'Content-Length' => xml_data.length.to_s, 'Authorization' => "Basic #{base64user_and_pass}", "Connection" => "keep-alive" })
puts res.body