Class: Ubiquitously::Tweako::Post
- Inherits:
-
Service::Post
- Object
- Base
- Service::Post
- Ubiquitously::Tweako::Post
- Defined in:
- lib/ubiquitously/services/tweako.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
- #create ⇒ Object
-
#tokenize ⇒ Object
Either your first 400 characters will be used, or you can determine where the teaser ends by starting a new paragraph before the first 400 characters.
Methods inherited from Service::Post
Methods included from Loggable::Post
Methods included from Restful::Post
Methods included from Postable::Post
Methods included from Ownable::Post
Methods inherited from Base
Methods included from SubclassableCallbacks
Constructor Details
This class inherits a constructor from Ubiquitously::Service::Post
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ubiquitously/services/tweako.rb', line 32 def create page = agent.get("http://www.tweako.com/node/add/storylink") form = page.forms.detect { |form| form.form_node["id"] == "node-form" } form["edit[title]"] = token[:title] form["edit[vote_storylink_url]"] = token[:url] form.field_with(:name => "edit[taxonomy][1]")..each do |option| option.select if option.value.to_s == "11" end form["edit[taxonomy][tags][2]"] = token[:tags] form["edit[body]"] = token[:description] form["op"] = "Submit" unless debug? page = form.submit end true end |
#tokenize ⇒ Object
Either your first 400 characters will be used, or you can determine where the teaser ends by starting a new paragraph before the first 400 characters. Make sure there is no text formatting or images in the teasers!
A comma-separated list of terms describing this content. Example: photoshop, free software. Limit the amount of terms to a maximum of 6. Please choose relevent and descriptive terms. Enter tags in ALL lower-case letters, and ensure spelling is correct.
25 26 27 28 29 30 |
# File 'lib/ubiquitously/services/tweako.rb', line 25 def tokenize super.merge( :description => self.description[0..400], :tags => self.[0..6].taggify(" ", ", ") ) end |