uw_sws 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8280c4c4d7c53d4b8db2172da8bd54ae9dc07035
4
- data.tar.gz: f7488e1380e67b50c415eb94f842c1533975c166
3
+ metadata.gz: ecc91f5222c15c8b995a44fa3f5a7a91aa0b69ed
4
+ data.tar.gz: 415acff531dd1fa7d7db4b09f768291d50cbdd32
5
5
  SHA512:
6
- metadata.gz: 1dadb6e89c3d0deb4a93769f259f255c4a0bcece0b8fd2c852c2b127393927e7752b67c7cadea0bda17a2d974b4813e9d7a809612fb0abafbd8da82063f98778
7
- data.tar.gz: 0c844e73b897aac7046cb5c085fb1e9f6ff97500114fff1f83d4c5a345b258f434ed9f49291d30cc56722944e1a45ff44fc1473952eb00bff242b401f85a2e20
6
+ metadata.gz: 95dc7bb33ccf0019262442864c47491e6c52d048256f2d1d000f541228f31a11d39a7eecab5585a36b9d1a610cce0d6393de1f62441ad0d632b2999b729e2597
7
+ data.tar.gz: 2908edda9c2fd567cf8859cafb7d7383485217738ab43dd303596999d0425829e1eda92612c064665ebf889b768ab4661e54ae234f0a3f3cef1e6b1c67005eda
@@ -182,7 +182,7 @@ class UwSws
182
182
 
183
183
  def parse(url)
184
184
  data = request "#{@base}#{url}"
185
- return nil unless !data.nil?
185
+ return nil unless !data.to_s.empty?
186
186
  data = clean data
187
187
 
188
188
  @last = JSON.parse data
@@ -212,6 +212,8 @@ class UwSws
212
212
  @logger.warn("#{url} - #{response.to_s}")
213
213
  elsif response.code == 404 && !@throw_404
214
214
  @logger.warn("#{url} - 404")
215
+ # hacky way to cache a 404 vs. saving the html the server sends back
216
+ set_cache("", cache_path)
215
217
  else
216
218
  raise "Errors for #{url}\n#{response.to_s}"
217
219
  end
@@ -1,3 +1,3 @@
1
1
  module UwSws
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
@@ -20,8 +20,12 @@ describe UwSws do
20
20
  key = config["key"]
21
21
  # url = "https://wseval.s.uw.edu/student/v5/"
22
22
  @regid = "9136CCB8F66711D5BE060004AC494FFE"
23
- @uw = UwSws.new(cert: cert, key: key, throw_HEPPS: false,
24
- logger: log, use_cache: true)
23
+ @uw = UwSws.new(cert: cert,
24
+ key: key,
25
+ throw_HEPPS: false,
26
+ throw_404: false,
27
+ logger: log,
28
+ use_cache: true)
25
29
  end
26
30
 
27
31
  describe "when getting test scores for a specific type " do
@@ -38,6 +42,14 @@ describe UwSws do
38
42
  end
39
43
  end
40
44
 
45
+ describe "when getting all test scores for invalid regid " do
46
+ it "it must not error" do
47
+ # this is not a valid regid, so result should be nil and not 404
48
+ tests = @uw.tests("9136CCB8F66711D5BE060004AC494FFF")
49
+ tests.must_be_nil
50
+ end
51
+ end
52
+
41
53
  describe "when getting term " do
42
54
  it "it must not be nil" do
43
55
  @uw.term(2013, :summer)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uw_sws
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nogbit