Sha256: bd586a513e5765b9b89911053e5d9c3111b320a99f76b5bd5abf3d76087a20a0

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Ubiquitously
  module DesignBump
    class Account < Ubiquitously::Service::Account
      def login
        page = agent.get("http://designbump.com/login")
        form = page.forms.detect { |form| form.form_node["id"] == "user-login-form" }
        form["name"] = username
        form["pass"] = password
        page = form.submit
        
        authorize!(page.uri != "http://designbump.com/user?destination=login")
      end
    end
    
    # drupal
    class Post < Ubiquitously::Service::Post
      
      def tokenize
        super.merge(:tags => tags.taggify(" ", :quote => true))
      end
      
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ubiquitously-0.1.0 lib/ubiquitously/services/design_bump.rb