Class: Ubiquitously::DesignBump::Post

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

Overview

drupal

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



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ubiquitously/services/design_bump.rb', line 22

def create
  page = agent.get("http://designbump.com/submit")
  form = page.form_with(:action => "/submit")
  
  form["url"] = token[:url]
  form["title"] = token[:title]
  form["body"] = token[:description]
  form.field_with(:name => "taxonomy[1]").options.each do |option|
    option.select if option.value.to_s == "21"
  end
  form["taxonomy[tags][2]"] = token[:tags]
  form["op"] = "Save"
  
  page = form.submit
  
  true
end

#tokenizeObject



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

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