Skip to content

Instantly share code, notes, and snippets.

@sealabcore
Created June 7, 2010 23:23
Show Gist options
  • Save sealabcore/429338 to your computer and use it in GitHub Desktop.
Save sealabcore/429338 to your computer and use it in GitHub Desktop.
def initialize(email=nil, password=nil)
05 @host = 'http://www.tumblr.com'
06 @action = '/login'
07 login(email, password) if email and password
08 end
09
10 def login(email, password)
11 res = Net::HTTP.post_form(URI.parse(@host+@action),{'email'=> email, 'password'=> password })
12 case res
13 when Net::HTTPSuccess
14 puts "success"
15 puts res
16 puts dashboard
17 else
18 puts res.error!
19 end
20 end
21
22 def dashboard
23 @action = '/dashboard'
24 Net::HTTP.get_response(URI.parse(@host+@action))
25 end
26
27 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment