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 +4 -4
- data/lib/uw_sws.rb +3 -1
- data/lib/uw_sws/version.rb +1 -1
- data/test/test_endpoints.rb +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc91f5222c15c8b995a44fa3f5a7a91aa0b69ed
|
4
|
+
data.tar.gz: 415acff531dd1fa7d7db4b09f768291d50cbdd32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95dc7bb33ccf0019262442864c47491e6c52d048256f2d1d000f541228f31a11d39a7eecab5585a36b9d1a610cce0d6393de1f62441ad0d632b2999b729e2597
|
7
|
+
data.tar.gz: 2908edda9c2fd567cf8859cafb7d7383485217738ab43dd303596999d0425829e1eda92612c064665ebf889b768ab4661e54ae234f0a3f3cef1e6b1c67005eda
|
data/lib/uw_sws.rb
CHANGED
@@ -182,7 +182,7 @@ class UwSws
|
|
182
182
|
|
183
183
|
def parse(url)
|
184
184
|
data = request "#{@base}#{url}"
|
185
|
-
return nil unless !data.
|
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
|
data/lib/uw_sws/version.rb
CHANGED
data/test/test_endpoints.rb
CHANGED
@@ -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,
|
24
|
-
|
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)
|