Sha256: 957caf7ac8dc8131bd50d4e00b8b56bd8913f2d644907ef115a538f7d6126156

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

module Ubiquitously
  module Nestdev
    class Account < Ubiquitously::Service::Account
      def login
        page = agent.get("http://nestdev.com/wp-login.php")
        form = page.form_with(:name => "loginform")
        form["log"] = username
        form["pwd"] = password
        form.checkboxes.first.check
        page = form.submit
        
        authorize!(page.parser.css("#login_error").first.nil?)
      end
    end
    
    class Post < Ubiquitously::Service::Post
      def create
        page = agent.get("http://nestdev.com/")
        form = page.form_with(:name => "new_post")
        
        form["posttitle"] = token[:title]
        form["posturl"] = token[:url]
        form.field_with(:name => "post_category").options.each do |option|
          option.select if option.value.to_s == "158"
        end
        # max length == 800
        form["tags"] = token[:tags]
        form["posttext"] = description
        
        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/nestdev.rb