Class: Ubiquitously::Propeller::Post

Inherits:
Service::Post show all
Defined in:
lib/ubiquitously/services/propeller.rb

Instance Attribute Summary

Attributes inherited from Service::Post

#captcha, #categories, #description, #downvotes, #extension, #format, #image, #kind, #must_be_unique, #privacy, #rating, #remote, #service_id, #service_url, #slug, #source, #source_url, #state, #status, #tags, #title, #token, #upvotes, #url, #user, #vote

Instance Method Summary collapse

Methods inherited from Service::Post

#access_token, #initialize

Methods included from Loggable::Post

included

Methods included from Restful::Post

included

Methods included from Ubiquitously::Postable::Post

included

Methods included from Ownable::Post

included

Methods inherited from Base

#apply, #debug?

Methods included from SubclassableCallbacks

included, override

Constructor Details

This class inherits a constructor from Ubiquitously::Service::Post

Instance Method Details

#createObject



22
23
24
25
26
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
# File 'lib/ubiquitously/services/propeller.rb', line 22

def create
  # url
  page        = agent.get("http://www.propeller.com/story/submit/")
  form        = page.forms.detect {|form| form.form_node["method"].downcase == "post"}
  form["url"] = token[:url]
  
  # details
  # http://www.propeller.com/story/submit/content/
  page        = form.submit
  form        = page.forms.detect {|form| form.form_node["method"].downcase == "post"}

  form.radiobuttons_with(:name => "title_multi").each do |button|
    button.check if button.value == "-1"
  end
  
  form["title_multi_text"] = token[:title]
  form["description"]      = token[:description]
  # separate by space, multi words are underscored
  form["user_tags"]        = token[:tags]
  
  form.radiobuttons_with(:name => "category").each do |button|
    button.check if button.value.to_s == "18"
  end
  
  # http://www.propeller.com/story/submit/preview/
  page = form.submit

  # approve
  page.forms[1].submit
  
  unless debug?
    page = form.submit
  end
  
  true
end

#tokenizeObject

title max == 150



18
19
20
# File 'lib/ubiquitously/services/propeller.rb', line 18

def tokenize
  super.merge(:tags => tags.taggify("_", " "))
end