Class: Ubiquitously::Propeller::Post
- Inherits:
-
Base::Post
- Object
- Base::Post
- Ubiquitously::Propeller::Post
- Defined in:
- lib/ubiquitously/propeller.rb
Instance Attribute Summary
Attributes inherited from Base::Post
#categories, #description, #service_url, #tags, #title, #url, #user
Instance Method Summary collapse
Methods inherited from Base::Post
Methods included from Resourceful
Instance Method Details
#save ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ubiquitously/propeller.rb', line 27 def save return false unless valid? user.login # url page = agent.get("http://www.propeller.com/story/submit/") form = page.forms.detect {|form| form.form_node["method"].downcase == "post"} form["url"] = url puts "SUBMIT FORM" # details # http://www.propeller.com/story/submit/content/ page = form.submit form = page.forms.detect {|form| form.form_node["method"].downcase == "post"} puts "DETAILS" form.(:name => "title_multi").each do || .check if .value == "-1" end form["title_multi_text"] = title form["description"] = description # separate by space, multi words are underscored form["user_tags"] = .map {|tag| tag.underscore.gsub(/[\s|-]+/, "_")}.join(" ") form.(:name => "category").each do || .check if .value.to_s == "18" end # http://www.propeller.com/story/submit/preview/ page = form.submit puts "SUBMIT DETAILS" # approve page.forms[1].submit unless [:debug] == true page = form.submit end true end |