Sha256: c53125beabb075528256aef6db5ba91375e358df51accb5387379007a3a51a7f

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

require 'mechanize'

module Engrade

  class Browser

    def initialize
      @agent
    end

    def login(u, p)
      @agent = Mechanize.new
      form = @agent.get('https://www.engrade.com/user/login.php').forms.first
      form.usr = u
      form.pwd = p
      @agent.submit(form)
    end

    def remove_comments(clid, assnid)
      page = @agent.get "https://www.engrade.com/class/assignments/edit.php?assnid=#{assnid}&clid=#{clid}"
      scores = page.form.fields_with(:name => /^score/)
      scores.each { |score| score.value = "" }
      @agent.submit(page.form)
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
engrade-1.2.0 lib/engrade/browser.rb
engrade-1.1.2 lib/engrade/browser.rb
engrade-1.1.1 lib/engrade/browser.rb
engrade-1.0.1 lib/engrade/browser.rb
engrade-1.0.0 lib/engrade/browser.rb