HTTPCookieProcessor in ruby

im a python developer, and i am starting learn ruby porting an previous
program i did, to interact with my ruby on rails application, but i
don’t know how to develop this kind of behavior on ruby

self.o = urllib.request.build_opener(
urllib.request.HTTPCookieProcessor() )
urllib.request.install_opener( self.o )
p = urllib.parse.urlencode( { ‘email’: email, ‘password’: pw } )
f = site, p )

with as fd:
body =“utf8”)

any help?