Module: Poly

Included in:
Auth, Period, Schedule
Defined in:
lib/polyhoraire.rb

Defined Under Namespace

Classes: Auth, Course, Period, Schedule, Trimester

Constant Summary collapse

URL =
{
:connection => "https://www4.polymtl.ca/servlet/ValidationServlet",
:schedule   => "https://www4.polymtl.ca/servlet/PresentationHorairePersServlet"
}
XSLDocs =
{
  :poly2XML     => File.dirname(__FILE__).to_s + "/polyhoraire/poly2XML.xsl",
  :exportGoogle => File.dirname(__FILE__).to_s + "/google.xml.xsl"
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.userConfDirObject



24
25
26
# File 'lib/polyhoraire.rb', line 24

def self.userConfDir
  @userConfDir
end

.userConfDir=(value) ⇒ Object



27
28
29
# File 'lib/polyhoraire.rb', line 27

def self.userConfDir=(value)
  @userConfDir = value
end

Instance Method Details

#fetch(uri, params) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/polyhoraire.rb', line 31

def fetch(uri,params)
  url = URI.parse(uri)
  
  req = Net::HTTP::Post.new(url.path)
  req.form_data = params
  con = Net::HTTP.new(url.host, url.port)
  con.use_ssl = true
  response = con.start {|http| http.request(req)}

  case response
  when Net::HTTPSuccess, Net::HTTPRedirection
    return response
  else
    response.error!
  end
end