module PolyNotify::Dossier_Etudiant
Public Instance Methods
extract_horaire(doc)
click to toggle source
# File lib/PolyNotify/dossier_etudiant.rb, line 37 def extract_horaire(doc) horaire = doc.css('table').select {|table| table['cellspacing'] == '5'} end
extract_notes(doc)
click to toggle source
# File lib/PolyNotify/dossier_etudiant.rb, line 32 def extract_notes(doc) tables = doc.css('table').select {|table| table['width'] == '75%'} @checksum = Digest::MD5.hexdigest(tables[0]) end
get_horaire(session)
click to toggle source
# File lib/PolyNotify/dossier_etudiant.rb, line 18 def get_horaire(session) @inputs['trimestre'] = session body = @inputs data = post('/servlet/PresentationHorairePersServlet', :body => body, :headers => {'Content-Type' => 'application/x-www-form-urlencoded'}) doc = Nokogiri.parse(data) extract_horaire doc end
get_resultats_finaux()
click to toggle source
# File lib/PolyNotify/dossier_etudiant.rb, line 11 def get_resultats_finaux body = @inputs data = post('/servlet/PresentationResultatsTrimServlet', :body => body, :headers => {'Content-Type' => 'application/x-www-form-urlencoded'}) doc = Nokogiri.parse(data) extract_notes doc end
log_in()
click to toggle source
# File lib/PolyNotify/dossier_etudiant.rb, line 4 def log_in body = {code: @config['CODE'], nip: @config['PASSWORD'], naissance: @config['DDN']} data = post('/servlet/ValidationServlet', :body => body, :headers => {'Content-Type' => 'application/x-www-form-urlencoded'}) doc = Nokogiri.parse(data) save_data doc end
save_data(doc)
click to toggle source
# File lib/PolyNotify/dossier_etudiant.rb, line 26 def save_data (doc) doc.css('input').each do |input| @inputs[input['name']] = input['value'] unless input['name'].include? 'btn' end end