rubyuw 0.99.16 → 0.99.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/rubyuw/sln.rb +23 -14
  3. data/rubyuw.gemspec +2 -2
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.99.16
1
+ 0.99.17
data/lib/rubyuw/sln.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module RubyUW
2
- # RubyUW::SLN is used to find and extract information about
2
+ # RubyUW::SLN is used to find and extract information about
3
3
  # specific SLNs. It grabs SLN information via the MyUW time
4
4
  # schedule.
5
5
  #
@@ -16,7 +16,7 @@ module RubyUW
16
16
  # sln_info = RubyUW::SLN.find("12345", "AUT+2009")
17
17
  class SLN
18
18
  attr_reader :sln
19
-
19
+
20
20
  # Initialize a new SLN object. This should never be called on its
21
21
  # own, but instead you should use the find method to setup a
22
22
  # sln.
@@ -29,7 +29,7 @@ module RubyUW
29
29
  @term = term
30
30
  @data = data
31
31
  end
32
-
32
+
33
33
  # Grab the data of the SLN based on a key. Returns the value of
34
34
  # a field for the SLN, or nil otherwise. Supported fields coming
35
35
  # soon.
@@ -51,7 +51,7 @@ module RubyUW
51
51
  # on the course info page.
52
52
  # * *room_capacity* - The capacity of the classroom.
53
53
  # * *section* - The section of the course. Ex. "A" or "AB"
54
- # * *space_available* -
54
+ # * *space_available* -
55
55
  # Space available at the moment. Note that there is an important difference
56
56
  # between this and the difference between "limit_enrollment" and
57
57
  # "current_enrollmemnt." This is because sometimes the university closes
@@ -64,11 +64,11 @@ module RubyUW
64
64
  def [](key)
65
65
  @data[key.to_sym]
66
66
  end
67
-
67
+
68
68
  # Aliased for legacy
69
69
  alias :data :[]
70
-
71
- class <<self
70
+
71
+ class << self
72
72
  # Finds information about a specific SLN. The SLN information
73
73
  # is grabbed from the MyUW time schedule page. Authentication is
74
74
  # required prior to use.
@@ -80,7 +80,16 @@ module RubyUW
80
80
  raise Errors::NotLoggedInError.new unless Base.authenticated?
81
81
 
82
82
  # Grab the SLN page and check for various failure scenarios
83
- page = Base.connection.get("https://sdb.admin.washington.edu/timeschd/uwnetid/sln.asp?QTRYR=#{term}&SLN=#{sln_number}")
83
+ url = "https://sdb.admin.washington.edu/timeschd/uwnetid/sln.asp?QTRYR=#{term}&SLN=#{sln_number}"
84
+ page = Base.connection.get(url)
85
+ if page.form_with(:name => "relay")
86
+ # Strange thing UW began implementing 08/31/2010. This is to
87
+ # get around it.
88
+ page = Base.connection.goto(url).
89
+ submit_form('relay').
90
+ submit_form('relay').execute!
91
+ end
92
+
84
93
  raise Errors::SLNRequestedTooSoonError.new if requested_too_soon?(page)
85
94
  raise Errors::SLNDoesNotExistError.new if !sln_exists?(page)
86
95
  raise Errors::SLNServiceClosedError.new if time_schedule_closed?(page)
@@ -120,7 +129,7 @@ module RubyUW
120
129
 
121
130
  data
122
131
  end
123
-
132
+
124
133
  # Extracts the "curriculum" from the SLN information. This curriculum
125
134
  # can then be used with {RubyUW::CurriculumEnrollment} to grab multiple
126
135
  # classes within the same curriculum simultaneously.
@@ -128,7 +137,7 @@ module RubyUW
128
137
  # The curriculum value used to query the enrollment page appears to
129
138
  # follow the pattern that it is the course category, URL encoded.
130
139
  #
131
- # Examples:
140
+ # Examples:
132
141
  # * CHEM 102 = "CHEM"
133
142
  # * C LIT 240 = "C LIT"
134
143
  #
@@ -142,19 +151,19 @@ module RubyUW
142
151
  end
143
152
  end
144
153
  end
145
-
154
+
146
155
  module Errors
147
156
  # An error indicating that an SLN was requested back-to-back too
148
157
  # quickly. MyUW enforces a timeout between requests for SLN information,
149
158
  # and when this is not obeyed, this error will be thrown by RubyUW.
150
159
  class SLNRequestedTooSoonError < Error; end
151
-
160
+
152
161
  # An error indicating that an SLN requested is invalid (does not
153
162
  # exist).
154
163
  class SLNDoesNotExistError < Error; end
155
-
164
+
156
165
  # An error indicating that the time scheduling service of MyUW
157
166
  # is currently closed.
158
167
  class SLNServiceClosedError < Error; end
159
168
  end
160
- end
169
+ end
data/rubyuw.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rubyuw}
8
- s.version = "0.99.16"
8
+ s.version = "0.99.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mitchell Hashimoto"]
12
- s.date = %q{2010-08-31}
12
+ s.date = %q{2010-09-08}
13
13
  s.description = %q{Library which provides a ruby interface to the University of Washington student portal.}
14
14
  s.email = %q{mitchell.hashimoto@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyuw
3
3
  version: !ruby/object:Gem::Version
4
- hash: 435
4
+ hash: 433
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 99
9
- - 16
10
- version: 0.99.16
9
+ - 17
10
+ version: 0.99.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mitchell Hashimoto
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-31 00:00:00 -07:00
18
+ date: 2010-09-08 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency