Created
November 10, 2015 17:56
-
-
Save kiliankoe/b7efac873b2073ed5e47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'mechanize' | |
mechanize = Mechanize.new | |
poll_name = ARGV[0] | |
options = ARGV.slice(1,ARGV.count) | |
# Create Dudle Page | |
page = mechanize.get('https://dudle.inf.tu-dresden.de') | |
create_dudle_form = page.forms.first | |
create_dudle_form['create_poll'] = poll_name | |
create_dudle_form.radiobutton_with(:id => 'chooseTime').checked = false | |
create_dudle_form.radiobutton_with(:id => 'chooseNormal').checked = true | |
page = create_dudle_form.submit | |
# Add and remove columns page | |
options.each do |opt| | |
option = page.forms.first | |
option['new_columnname'] = opt | |
page = option.submit | |
end | |
page = page.forms.last.click_button() | |
# Last page | |
puts "Poll \"#{poll_name}\": #{page.at('#humanReadableURL')['value']}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment