Class: Hackershout::Provider::Reddit
- Defined in:
- lib/hackershout/provider/reddit.rb
Constant Summary collapse
- URL =
{ :login => 'http://www.reddit.com/r/ruby/', :submit => 'http://www.reddit.com/r/ruby/submit', }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#post ⇒ Object
Not logging in! :(.
Methods inherited from Base
Methods included from Output
Constructor Details
This class inherits a constructor from Hackershout::Provider::Base
Instance Method Details
#post ⇒ Object
Not logging in! :(
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hackershout/provider/reddit.rb', line 11 def post raise NotImplementedError page = agent.get(URL[:login]) login_form = page.forms_with(:action => 'http://www.reddit.com/r/ruby/post/login').first login_form.user = @login login_form.passwd = @password page = login_form.submit puts page.links_with(:text => 'logout').inspect page = page.links_with(:text => 'Submit a link').first.click puts page.inspect rescue Mechanize::ResponseCodeError=>e puts "#{@name} is unavailable for now. Please try in a few minutes. The server gave the following reason:" puts e.inspect end |