Sha256: 5fbc65d54d15e9a207ee6f88ba9b1853f806c1cf63b0b65b9ec99db12332329d

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module Ubiquitously
  module Flikode
    class Account < Ubiquitously::Service::Account
      def login
        page = agent.get("http://flikode.com/login")
        form = page.form_with(:name => "login")
        form["username"] = username
        form["password"] = password
        page = form.submit
        
        authorize!(page.uri != "http://flikode.com/login")
      end
    end
    
    class Post < Ubiquitously::Service::Post
      def create
        page = agent.get("http://flikode.com/snippet")
        form = page.form_with(:name => "snippet")
        
        form["title"] = token[:title]
        form["description"] = token[:description]
        form["tags"] = token[:tags]
        
        form.field_with(:name => "language").options.each do |option|
          option.select if option.text.to_s.strip.downcase =~ /#{format}/
        end
        
        form.radiobuttons_with(:name => "choose").last.check
        
        form["snippet"] = token[:body]
        
        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/flikode.rb