powerapi 1.0.0
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 +7 -0
- data/.gitignore +22 -0
- data/.travis.yml +3 -0
- data/ACKNOWLEDGEMENTS.md +31 -0
- data/Gemfile +4 -0
- data/README.md +62 -0
- data/Rakefile +6 -0
- data/lib/powerapi/assignment.rb +27 -0
- data/lib/powerapi/exception.rb +7 -0
- data/lib/powerapi/parser.rb +97 -0
- data/lib/powerapi/section.rb +45 -0
- data/lib/powerapi/student.rb +73 -0
- data/lib/powerapi/version.rb +3 -0
- data/lib/powerapi.rb +34 -0
- data/powerapi.gemspec +30 -0
- data/spec/assignment_spec.rb +84 -0
- data/spec/fixtures/authentication/failure.xml +17 -0
- data/spec/fixtures/authentication/success.xml +28 -0
- data/spec/fixtures/transcript.json +464 -0
- data/spec/parser_spec.rb +150 -0
- data/spec/powerapi_spec.rb +37 -0
- data/spec/section_spec.rb +127 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/student_spec.rb +113 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7ca79c15ad25142ea25914fcd2d7d24f77ec5008
|
4
|
+
data.tar.gz: 3da80c3b78f502ef4220cdae6f78683de05ab35c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4a88233f2b4cd8df56e2b739c5c028231957fb50b5e19c5915743f15ceb997d68722f3fad0de3f4e6f4da1ddd1dd481ee1f6f1be26e80db85c7d17dccf7e1c3
|
7
|
+
data.tar.gz: 3bb6dd7babbbedfa1ac0672019abcbd13892791c9b3b998bdc1bc316638d75544915ecb947f5633f3969be1e4c699cbc65bc74d8d5a67d6f6ece70ab603e6519
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/ACKNOWLEDGEMENTS.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Acknowledgements
|
2
|
+
|
3
|
+
## People
|
4
|
+
* [Daniel Tomlinson](https://twitter.com/dantoml) for pointing out areas where
|
5
|
+
I diverged from the Ruby status-quo.
|
6
|
+
* [Ross Penman](https://twitter.com/PenmanRoss) for always being around to
|
7
|
+
answer questions about Ruby oddities.
|
8
|
+
* The PowerSchool team at Pearson School Systems for finally exposing a
|
9
|
+
working machine readable version of student data.
|
10
|
+
|
11
|
+
## Savon
|
12
|
+
Copyright (c) 2010 Daniel Harrington
|
13
|
+
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
15
|
+
a copy of this software and associated documentation files (the
|
16
|
+
"Software"), to deal in the Software without restriction, including
|
17
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
18
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
19
|
+
permit persons to whom the Software is furnished to do so, subject to
|
20
|
+
the following conditions:
|
21
|
+
|
22
|
+
The above copyright notice and this permission notice shall be
|
23
|
+
included in all copies or substantial portions of the Software.
|
24
|
+
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
26
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
27
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
28
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
29
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
30
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
31
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
[](https://travis-ci.org/powerapi/powerapi-ruby)
|
2
|
+
[](https://coveralls.io/r/powerapi/powerapi-ruby)
|
3
|
+
[](https://codeclimate.com/github/powerapi/powerapi-ruby)
|
4
|
+
[](https://rubygems.org/gems/powerapi)
|
5
|
+
|
6
|
+
PowerAPI-ruby
|
7
|
+
============
|
8
|
+
Library for fetching information from PowerSchool SISes.
|
9
|
+
|
10
|
+
Requirements
|
11
|
+
------------
|
12
|
+
* Ruby >= 2.0.0
|
13
|
+
* PowerSchool 8.x; PowerSchool >= 7.1.0
|
14
|
+
|
15
|
+
Installation
|
16
|
+
------------
|
17
|
+
You should use [RubyGems](https://rubygems.org/) to handle including/downloading
|
18
|
+
the library for you.
|
19
|
+
|
20
|
+
```
|
21
|
+
$ gem install powerapi
|
22
|
+
```
|
23
|
+
|
24
|
+
Usage example
|
25
|
+
-------------
|
26
|
+
```ruby
|
27
|
+
require "powerapi"
|
28
|
+
|
29
|
+
# Trade server details and the user's credentials for a student object.
|
30
|
+
student = PowerAPI.authenticate("http://powerschool.example", "username", "password")
|
31
|
+
|
32
|
+
# Print the student's name.
|
33
|
+
print student.information["firstName"] + " " + student.information["lastName"] + "\n"
|
34
|
+
|
35
|
+
# Print the student's sections.
|
36
|
+
student.sections.each do |section|
|
37
|
+
print section.name + "\n"
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
Copyright (c) 2014 Henri Watson
|
45
|
+
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
47
|
+
of this software and associated documentation files (the "Software"), to deal
|
48
|
+
in the Software without restriction, including without limitation the rights
|
49
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
50
|
+
copies of the Software, and to permit persons to whom the Software is
|
51
|
+
furnished to do so, subject to the following conditions:
|
52
|
+
|
53
|
+
The above copyright notice and this permission notice shall be included in
|
54
|
+
all copies or substantial portions of the Software.
|
55
|
+
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
62
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module PowerAPI
|
2
|
+
class Assignment
|
3
|
+
def initialize(details)
|
4
|
+
@details = details
|
5
|
+
end
|
6
|
+
|
7
|
+
def category
|
8
|
+
@details[:category]["name"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def description
|
12
|
+
@details[:assignment]["description"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
@details[:assignment]["name"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def percent
|
20
|
+
@details[:score]["percent"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def score
|
24
|
+
@details[:score]["score"]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module PowerAPI
|
2
|
+
class Parser
|
3
|
+
def self.assignments(raw_assignments, assignment_categories, assignment_scores)
|
4
|
+
assignments = {}
|
5
|
+
|
6
|
+
raw_assignments.each do |assignment|
|
7
|
+
if assignments[assignment["sectionid"]] == nil
|
8
|
+
assignments[assignment["sectionid"]] = []
|
9
|
+
end
|
10
|
+
|
11
|
+
assignments[assignment["sectionid"]] << PowerAPI::Assignment.new({
|
12
|
+
:assignment => assignment,
|
13
|
+
:category => assignment_categories[assignment["categoryId"]],
|
14
|
+
:score => assignment_scores[assignment["id"]],
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
assignments
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.assignment_categories(raw_assignment_categories)
|
22
|
+
assignment_categories = {}
|
23
|
+
|
24
|
+
raw_assignment_categories.each do |assignment_category|
|
25
|
+
assignment_categories[assignment_category["id"]] = assignment_category
|
26
|
+
end
|
27
|
+
|
28
|
+
assignment_categories
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.assignment_scores(raw_assignment_scores)
|
32
|
+
assignment_scores = {}
|
33
|
+
|
34
|
+
raw_assignment_scores.each do |assignment_score|
|
35
|
+
assignment_scores[assignment_score["assignmentId"]] = assignment_score
|
36
|
+
end
|
37
|
+
|
38
|
+
assignment_scores
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.final_grades(raw_final_grades)
|
42
|
+
final_grades = {}
|
43
|
+
|
44
|
+
raw_final_grades.each do |final_grade|
|
45
|
+
if final_grades[final_grade["sectionid"]] == nil
|
46
|
+
final_grades[final_grade["sectionid"]] = []
|
47
|
+
end
|
48
|
+
|
49
|
+
final_grades[final_grade["sectionid"]] << final_grade
|
50
|
+
end
|
51
|
+
|
52
|
+
final_grades
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.reporting_terms(raw_reporting_terms)
|
56
|
+
reporting_terms = {}
|
57
|
+
|
58
|
+
raw_reporting_terms.each do |reporting_term|
|
59
|
+
reporting_terms[reporting_term["id"]] = reporting_term["abbreviation"]
|
60
|
+
end
|
61
|
+
|
62
|
+
reporting_terms
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.sections(raw_sections, assignments, final_grades, reporting_terms, teachers)
|
66
|
+
sections = []
|
67
|
+
|
68
|
+
raw_sections.each do |section|
|
69
|
+
# PowerSchool will return sections that have not started yet.
|
70
|
+
# These are stripped since none of the official channels display them.
|
71
|
+
if DateTime.parse(section["enrollments"]["startDate"]).strftime("%s").to_i > DateTime.now.strftime("%s").to_i
|
72
|
+
next
|
73
|
+
end
|
74
|
+
|
75
|
+
sections << PowerAPI::Section.new({
|
76
|
+
:assignments => assignments[section["id"]],
|
77
|
+
:final_grades => final_grades[section["id"]],
|
78
|
+
:reporting_terms => reporting_terms,
|
79
|
+
:section => section,
|
80
|
+
:teacher => teachers[section["teacherID"]]
|
81
|
+
})
|
82
|
+
end
|
83
|
+
|
84
|
+
sections
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.teachers(raw_teachers)
|
88
|
+
teachers = {}
|
89
|
+
|
90
|
+
raw_teachers.each do |teacher|
|
91
|
+
teachers[teacher["id"]] = teacher
|
92
|
+
end
|
93
|
+
|
94
|
+
teachers
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module PowerAPI
|
2
|
+
class Section
|
3
|
+
def initialize(details)
|
4
|
+
@details = details
|
5
|
+
|
6
|
+
# Occasionally, a section won't have any final_grades objects
|
7
|
+
if @details[:final_grades] != nil
|
8
|
+
@final_grades = {}
|
9
|
+
|
10
|
+
@details[:final_grades].each do |final_grade|
|
11
|
+
@final_grades[
|
12
|
+
@details[:reporting_terms][final_grade["reportingTermId"]]
|
13
|
+
] = final_grade["percent"]
|
14
|
+
end
|
15
|
+
else
|
16
|
+
@final_grades = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def assignments
|
21
|
+
@details[:assignments]
|
22
|
+
end
|
23
|
+
|
24
|
+
def final_grades
|
25
|
+
@final_grades
|
26
|
+
end
|
27
|
+
|
28
|
+
def name
|
29
|
+
@details[:section]["schoolCourseTitle"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def room_name
|
33
|
+
@details[:section]["roomName"]
|
34
|
+
end
|
35
|
+
|
36
|
+
def teacher
|
37
|
+
{
|
38
|
+
:first_name => @details[:teacher]["firstName"],
|
39
|
+
:last_name => @details[:teacher]["lastName"],
|
40
|
+
:email => @details[:teacher]["email"],
|
41
|
+
:school_phone => @details[:teacher]["schoolPhone"]
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module PowerAPI
|
2
|
+
class Student
|
3
|
+
def initialize(soap_url, soap_session, populate=true)
|
4
|
+
@soap_url = soap_url
|
5
|
+
@soap_session = soap_session
|
6
|
+
|
7
|
+
if populate
|
8
|
+
self.populate()
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def populate()
|
13
|
+
transcript = self.fetch_transcript
|
14
|
+
self.parse_transcript(transcript)
|
15
|
+
end
|
16
|
+
|
17
|
+
def fetch_transcript()
|
18
|
+
student_client = Savon.client(
|
19
|
+
endpoint: @soap_url + "/pearson-rest/services/PublicPortalServiceJSON?response=application/json",
|
20
|
+
namespace: "http://publicportal.rest.powerschool.pearson.com/xsd",
|
21
|
+
digest_auth: ["pearson", "m0bApP5"]
|
22
|
+
)
|
23
|
+
|
24
|
+
transcript_params = {
|
25
|
+
userSessionVO: {
|
26
|
+
userId: @soap_session[:user_id],
|
27
|
+
serviceTicket: @soap_session[:service_ticket],
|
28
|
+
serverInfo: {
|
29
|
+
apiVersion: @soap_session[:server_info][:api_version]
|
30
|
+
},
|
31
|
+
serverCurrentTime: "2012-12-26T21:47:23.792Z", # I really don't know.
|
32
|
+
userType: "2"
|
33
|
+
},
|
34
|
+
studentIDs: @soap_session[:student_i_ds],
|
35
|
+
qil: {
|
36
|
+
includes: "1"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
transcript = student_client.call(:get_student_data, message: transcript_params).to_xml
|
41
|
+
|
42
|
+
JSON.parse(transcript)
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_transcript(transcript)
|
46
|
+
@student_data = transcript["return"]["studentDataVOs"]
|
47
|
+
|
48
|
+
@student_data["student"].delete("@type")
|
49
|
+
|
50
|
+
assignment_categories = PowerAPI::Parser.assignment_categories(@student_data["assignmentCategories"])
|
51
|
+
assignment_scores = PowerAPI::Parser.assignment_scores(@student_data["assignmentScores"])
|
52
|
+
final_grades = PowerAPI::Parser.final_grades(@student_data["finalGrades"])
|
53
|
+
reporting_terms = PowerAPI::Parser.reporting_terms(@student_data["reportingTerms"])
|
54
|
+
teachers = PowerAPI::Parser.teachers(@student_data["teachers"])
|
55
|
+
|
56
|
+
assignments = PowerAPI::Parser.assignments(@student_data["assignments"], assignment_categories, assignment_scores)
|
57
|
+
|
58
|
+
@sections = PowerAPI::Parser.sections(@student_data["sections"], assignments, final_grades, reporting_terms, teachers)
|
59
|
+
|
60
|
+
return 0
|
61
|
+
end
|
62
|
+
|
63
|
+
def sections
|
64
|
+
@sections
|
65
|
+
end
|
66
|
+
|
67
|
+
def information
|
68
|
+
if @student_data != nil
|
69
|
+
@student_data["student"]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/powerapi.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "powerapi/exception.rb"
|
2
|
+
require "powerapi/parser.rb"
|
3
|
+
require "powerapi/version.rb"
|
4
|
+
|
5
|
+
require "powerapi/assignment.rb"
|
6
|
+
require "powerapi/section.rb"
|
7
|
+
require "powerapi/student.rb"
|
8
|
+
|
9
|
+
require "savon"
|
10
|
+
require "json"
|
11
|
+
|
12
|
+
module PowerAPI
|
13
|
+
module_function
|
14
|
+
|
15
|
+
def authenticate(url, username, password, fetch_transcript=true)
|
16
|
+
soap_endpoint = url + "/pearson-rest/services/PublicPortalService"
|
17
|
+
|
18
|
+
login_client = Savon.client(
|
19
|
+
endpoint: soap_endpoint,
|
20
|
+
namespace: "http://publicportal.rest.powerschool.pearson.com/xsd",
|
21
|
+
wsse_auth: ["pearson", "pearson"]
|
22
|
+
)
|
23
|
+
|
24
|
+
login = login_client.call(:login, message: { username: username, password: password, userType: 2} )
|
25
|
+
|
26
|
+
if login.body[:login_response][:return][:user_session_vo] == nil
|
27
|
+
raise PowerAPI::Exception.new(login.body[:login_response][:return][:message_v_os][:description])
|
28
|
+
end
|
29
|
+
|
30
|
+
session = login.body[:login_response][:return][:user_session_vo]
|
31
|
+
|
32
|
+
return PowerAPI::Student.new(url, session, fetch_transcript)
|
33
|
+
end
|
34
|
+
end
|
data/powerapi.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "powerapi/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "powerapi"
|
8
|
+
spec.version = PowerAPI::VERSION
|
9
|
+
spec.authors = ["Henri Watson"]
|
10
|
+
spec.email = ["henri@henriwatson.com"]
|
11
|
+
spec.summary = %q{Ruby API for PowerSchool.}
|
12
|
+
spec.description = %q{Library for fetching information from Pearson PowerSchool installs.}
|
13
|
+
spec.homepage = "http://powerapi.henriwatson.com/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "simplecov"
|
25
|
+
spec.add_development_dependency "coveralls"
|
26
|
+
|
27
|
+
spec.add_runtime_dependency "savon", "~> 2.0"
|
28
|
+
spec.add_runtime_dependency "httpclient", "~> 2.4.0"
|
29
|
+
spec.add_runtime_dependency "json", "~> 1.8.1"
|
30
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe PowerAPI::Assignment do
|
4
|
+
include Savon::SpecHelper
|
5
|
+
|
6
|
+
before(:all) {
|
7
|
+
savon.mock!
|
8
|
+
|
9
|
+
@session = {:locale=>nil, :server_current_time=>"2014-08-24T03:01:25.007Z", :server_info=>{:api_version=>"2.1.1", :day_light_savings=>"0", :parent_saml_end_point=>nil, :raw_offset=>"-14400000", :server_time=>"2014-08-24T20:19:32.640Z", :student_saml_end_point=>nil, :teacher_saml_end_point=>nil, :time_zone_name=>"BOT", :"@xsi:type"=>"ax287:ServerInfo"}, :service_ticket=>"AAABSAX2Ex5NZXRA4/w06RyTFVkPGkFNEiI3qRAS5pMC7TQkWqT2UQYfVv0/c0SaE70JFJa17maweiMcP1u0skwbYAVPoyNvduejg61AdiePjqJPyhJyJGyGHi3UmuWI", :student_i_ds=>"1", :user_id=>"1", :user_type=>"2", :"@xsi:type"=>"ax284:UserSessionVO"}
|
10
|
+
}
|
11
|
+
|
12
|
+
after(:all) {
|
13
|
+
savon.unmock!
|
14
|
+
}
|
15
|
+
|
16
|
+
before(:each) {
|
17
|
+
fixture = File.read("spec/fixtures/transcript.json")
|
18
|
+
message = {
|
19
|
+
userSessionVO: {
|
20
|
+
userId: "1",
|
21
|
+
serviceTicket: "AAABSAX2Ex5NZXRA4/w06RyTFVkPGkFNEiI3qRAS5pMC7TQkWqT2UQYfVv0/c0SaE70JFJa17maweiMcP1u0skwbYAVPoyNvduejg61AdiePjqJPyhJyJGyGHi3UmuWI",
|
22
|
+
serverInfo: {
|
23
|
+
apiVersion: "2.1.1"
|
24
|
+
},
|
25
|
+
serverCurrentTime: "2012-12-26T21:47:23.792Z",
|
26
|
+
userType: "2"
|
27
|
+
},
|
28
|
+
studentIDs: "1",
|
29
|
+
qil: {
|
30
|
+
includes: "1"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
savon.expects(:get_student_data).with(message: message).returns(fixture)
|
35
|
+
|
36
|
+
student = PowerAPI::Student.new("http://powerschool.example", @session)
|
37
|
+
|
38
|
+
@assignment = student.sections[0].assignments[0]
|
39
|
+
}
|
40
|
+
|
41
|
+
after(:each) {
|
42
|
+
@assignment = nil
|
43
|
+
}
|
44
|
+
|
45
|
+
describe "#category" do
|
46
|
+
it "is in the Sample category" do
|
47
|
+
expect(
|
48
|
+
@assignment.category
|
49
|
+
).to eq("Sample")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#description" do
|
54
|
+
it "has one assignment" do
|
55
|
+
expect(
|
56
|
+
@assignment.description
|
57
|
+
).to eq("Sample Description")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#name" do
|
62
|
+
it "has one assignment" do
|
63
|
+
expect(
|
64
|
+
@assignment.name
|
65
|
+
).to eq("Sample Assignment")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#percent" do
|
70
|
+
it "has one assignment" do
|
71
|
+
expect(
|
72
|
+
@assignment.percent
|
73
|
+
).to eq(100)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "#score" do
|
78
|
+
it "has one assignment" do
|
79
|
+
expect(
|
80
|
+
@assignment.score
|
81
|
+
).to eq(100)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<soapenv:Body>
|
4
|
+
<ns:loginResponse xmlns:ns="http://publicportal.rest.powerschool.pearson.com/xsd">
|
5
|
+
<return xmlns:ax284="http://vo.rest.powerschool.pearson.com/xsd" xmlns:ax287="http://model.rest.powerschool.pearson.com/xsd" xmlns:ax285="http://util.java/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax284:ResultsVO">
|
6
|
+
<messageVOs xsi:type="ax284:MessageVO">
|
7
|
+
<description>Invalid Username or password</description>
|
8
|
+
<id xsi:nil="true"/>
|
9
|
+
<msgCode>1</msgCode>
|
10
|
+
<title>Invalid Login</title>
|
11
|
+
</messageVOs>
|
12
|
+
<courseRequestRulesVO xsi:nil="true"/>
|
13
|
+
<userSessionVO xsi:nil="true"/>
|
14
|
+
</return>
|
15
|
+
</ns:loginResponse>
|
16
|
+
</soapenv:Body>
|
17
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<soapenv:Body>
|
4
|
+
<ns:loginResponse xmlns:ns="http://publicportal.rest.powerschool.pearson.com/xsd">
|
5
|
+
<return xmlns:ax284="http://vo.rest.powerschool.pearson.com/xsd" xmlns:ax287="http://model.rest.powerschool.pearson.com/xsd" xmlns:ax285="http://util.java/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax284:ResultsVO">
|
6
|
+
<courseRequestRulesVO xsi:nil="true"/>
|
7
|
+
<userSessionVO xsi:type="ax284:UserSessionVO">
|
8
|
+
<locale xsi:nil="true"/>
|
9
|
+
<serverCurrentTime>2014-08-24T03:01:24.992Z</serverCurrentTime>
|
10
|
+
<serverInfo xsi:type="ax287:ServerInfo">
|
11
|
+
<apiVersion>2.1.1</apiVersion>
|
12
|
+
<dayLightSavings>0</dayLightSavings>
|
13
|
+
<parentSAMLEndPoint/>
|
14
|
+
<rawOffset>-14400000</rawOffset>
|
15
|
+
<serverTime>2014-08-24T03:01:25.007Z</serverTime>
|
16
|
+
<studentSAMLEndPoint/>
|
17
|
+
<teacherSAMLEndPoint/>
|
18
|
+
<timeZoneName>BOT</timeZoneName>
|
19
|
+
</serverInfo>
|
20
|
+
<serviceTicket>AAABSAX2Ex5NZXRA4/w06RyTFVkPGkFNEiI3qRAS5pMC7TQkWqT2UQYfVv0/c0SaE70JFJa17maweiMcP1u0skwbYAVPoyNvduejg61AdiePjqJPyhJyJGyGHi3UmuWI</serviceTicket>
|
21
|
+
<studentIDs>1</studentIDs>
|
22
|
+
<userId>1</userId>
|
23
|
+
<userType>2</userType>
|
24
|
+
</userSessionVO>
|
25
|
+
</return>
|
26
|
+
</ns:loginResponse>
|
27
|
+
</soapenv:Body>
|
28
|
+
</soapenv:Envelope>
|