Net:SSH , how to give password for Sudo commands

I am using net/ssh (script) to SSH into an ubuntu box and install a
package using sudo apt-get install xyz

Currently when I run script err i see is:
sudo: no tty present and no askpass program specified

Issue is how to provide password in my script?

Please help
thanks

This works
http://www.experts-exchange.com/Programming/Languages/Scripting/Ruby/Q_27447641.html