Class: Ubiquitously::Chetzit::Post

Inherits:
Service::Post show all
Defined in:
lib/ubiquitously/services/chetzit.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 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



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ubiquitously/services/chetzit.rb', line 16

def create
  page = agent.get("http://chetzit.com/link/add/")
  form = page.forms.detect do |form|
    !form.form_node.css("input[name=security_ls_key]").first.blank?
  end
  
  form.field_with(:name => "blog_id").options.first.select
  
  form["topic_title"] = token[:title]
  form["topic_link_url"] = token[:url]
  # max 500 chars
  form["topic_text"] = token[:description]
  form["topic_tags"] = token[:tags]
  form["submit_topic_publish"] = "Submit New"
  
  page = form.submit(form.buttons.first)
  
  true
end