Created
June 7, 2010 23:23
-
-
Save sealabcore/429338 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
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