Class: Poly::Schedule
- Inherits:
-
Object
- Object
- Poly::Schedule
- Includes:
- Poly
- Defined in:
- lib/polyhoraire/schedule.rb
Constant Summary
Constants included from Poly
Instance Attribute Summary collapse
-
#trimester ⇒ Object
readonly
Returns the value of attribute trimester.
Instance Method Summary collapse
- #courses ⇒ Object
-
#initialize(auth, trimester) ⇒ Schedule
constructor
Trimesters : Hash of the possible trimesters => :label postParams : PostParams obtained from the connection.
- #to_xml ⇒ Object
- #to_xml_doc ⇒ Object
Methods included from Poly
#fetch, userConfDir, userConfDir=
Constructor Details
#initialize(auth, trimester) ⇒ Schedule
Trimesters : Hash of the possible trimesters => :label postParams : PostParams obtained from the connection
11 12 13 14 15 16 17 18 |
# File 'lib/polyhoraire/schedule.rb', line 11 def initialize(auth,trimester) @params = auth.postParams @trimesters = auth.trimesters @trimester = Poly::Trimester.fromYAML(trimester) get(trimester) end |
Instance Attribute Details
#trimester ⇒ Object (readonly)
Returns the value of attribute trimester.
7 8 9 |
# File 'lib/polyhoraire/schedule.rb', line 7 def trimester @trimester end |
Instance Method Details
#courses ⇒ Object
38 39 40 41 |
# File 'lib/polyhoraire/schedule.rb', line 38 def courses doc = to_xml_doc Poly::Course.from_nokogiri(doc) end |
#to_xml ⇒ Object
20 21 22 |
# File 'lib/polyhoraire/schedule.rb', line 20 def to_xml to_xml_doc.to_s end |
#to_xml_doc ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/polyhoraire/schedule.rb', line 24 def to_xml_doc html = @response.body.to_s # Too much spaces, substring-after wont work in some case if their still have trailling character ' ' html.gsub!(" ","") doc = Nokogiri::HTML(html) do |config| config.noent end xsl = Nokogiri::XSLT(File.read(Poly::XSLDocs[:poly2XML])) return xsl.transform(doc) end |