powerapi 1.0.0 → 1.0.1

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: 7ca79c15ad25142ea25914fcd2d7d24f77ec5008
4
- data.tar.gz: 3da80c3b78f502ef4220cdae6f78683de05ab35c
3
+ metadata.gz: 37841ff98ae99e8c2b0dd4b89464ab7c244a000d
4
+ data.tar.gz: 548bd5663509d0e6d35215ca755c5cf15eccc673
5
5
  SHA512:
6
- metadata.gz: c4a88233f2b4cd8df56e2b739c5c028231957fb50b5e19c5915743f15ceb997d68722f3fad0de3f4e6f4da1ddd1dd481ee1f6f1be26e80db85c7d17dccf7e1c3
7
- data.tar.gz: 3bb6dd7babbbedfa1ac0672019abcbd13892791c9b3b998bdc1bc316638d75544915ecb947f5633f3969be1e4c699cbc65bc74d8d5a67d6f6ece70ab603e6519
6
+ metadata.gz: c776a30b3c0bafdc48b4e758ed5a46722e2ceed47e40bf9aa6bf21159b8d2fda6c45d736ecb7a310da43c9c0d1f592020d1fff6220cd69ab6de0a0f774d565f7
7
+ data.tar.gz: 3586a016448f7c836d9f56db58521a1ec72357793dbdd8741b56727a89f0e13abaf380150d3d5ae124beec8ee7f4a3b2bdb504beebca111eb78b8a558858410f
@@ -81,6 +81,8 @@ module PowerAPI
81
81
  })
82
82
  end
83
83
 
84
+ sections = sections.sort_by{|section| [section.expression, section.name]}
85
+
84
86
  sections
85
87
  end
86
88
 
@@ -21,6 +21,10 @@ module PowerAPI
21
21
  @details[:assignments]
22
22
  end
23
23
 
24
+ def expression
25
+ @details[:section]["expression"]
26
+ end
27
+
24
28
  def final_grades
25
29
  @final_grades
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module PowerAPI
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/powerapi.rb CHANGED
@@ -13,6 +13,8 @@ module PowerAPI
13
13
  module_function
14
14
 
15
15
  def authenticate(url, username, password, fetch_transcript=true)
16
+ url = clean_url(url)
17
+
16
18
  soap_endpoint = url + "/pearson-rest/services/PublicPortalService"
17
19
 
18
20
  login_client = Savon.client(
@@ -31,4 +33,12 @@ module PowerAPI
31
33
 
32
34
  return PowerAPI::Student.new(url, session, fetch_transcript)
33
35
  end
36
+
37
+ def clean_url(url)
38
+ if url[-1] == "/"
39
+ url = url[0..-2]
40
+ else
41
+ url = url
42
+ end
43
+ end
34
44
  end
@@ -34,4 +34,18 @@ describe PowerAPI do
34
34
  ).to be_an_instance_of(PowerAPI::Student)
35
35
  end
36
36
  end
37
+
38
+ describe "#clean_url" do
39
+ it "leaves 'https://powerschool.example' alone" do
40
+ expect(
41
+ PowerAPI.clean_url("https://powerschool.example")
42
+ ).to eq("https://powerschool.example")
43
+ end
44
+
45
+ it "removes the slash in 'https://powerschool.example/'" do
46
+ expect(
47
+ PowerAPI.clean_url("https://powerschool.example/")
48
+ ).to eq("https://powerschool.example")
49
+ end
50
+ end
37
51
  end
data/spec/section_spec.rb CHANGED
@@ -57,6 +57,20 @@ describe PowerAPI::Section do
57
57
  end
58
58
  end
59
59
 
60
+ describe "#expression" do
61
+ it "has an expression of '1 (M-F)' at index 0" do
62
+ expect(
63
+ @section0.expression
64
+ ).to eq("1 (M-F)")
65
+ end
66
+
67
+ it "has an expression of '3 (M-F)' at index 1" do
68
+ expect(
69
+ @section1.expression
70
+ ).to eq("3 (M-F)")
71
+ end
72
+ end
73
+
60
74
  describe "#final_grades" do
61
75
  it "has one final grade at index 0" do
62
76
  expect(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powerapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henri Watson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-30 00:00:00.000000000 Z
11
+ date: 2014-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler