Created
June 29, 2009 16:49
-
-
Save Jabbslad/137695 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
class Session | |
FRIENDS_URL = "http://live.xbox.com/en-US/profile/Friends.aspx" | |
attr_reader :agent | |
def initialize | |
@agent = WWW::Mechanize.new | |
agent.user_agent_alias='Windows IE 7' | |
end | |
def sign_in(username, password) | |
page = agent.get(FRIENDS_URL) | |
login = page.form_with(:name => "f1") | |
login['login'] = username | |
login['passwd'] = password | |
login['LoginOptions'] = 2 | |
page = agent.submit(login) | |
page = agent.submit(page.form_with(:name => "fmHF")) | |
end | |
def sign_out | |
initialize | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment