great_schools 0.2.1 → 0.2.3
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 +5 -5
- data/Rakefile +8 -0
- data/great_schools.gemspec +4 -4
- data/lib/great_schools.rb +1 -1
- data/lib/great_schools/version.rb +1 -1
- data/spec/great_schools/census_spec.rb +12 -12
- data/spec/great_schools/city_spec.rb +27 -27
- data/spec/great_schools/district_spec.rb +18 -18
- data/spec/great_schools/ethnicity_spec.rb +4 -4
- data/spec/great_schools/rank_spec.rb +6 -6
- data/spec/great_schools/result_spec.rb +9 -9
- data/spec/great_schools/review_spec.rb +31 -31
- data/spec/great_schools/school_spec.rb +95 -95
- data/spec/great_schools/score_spec.rb +4 -4
- data/spec/great_schools/test_spec.rb +9 -9
- data/spec/great_schools_spec.rb +1 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6a5a30108f13ca85f684810394a1dde2a5c66d4c020fc9bd90bc47d3ffd0d221
|
4
|
+
data.tar.gz: 56350ed5520a3b4147bb3ae852d54f988ec440f9dd781262ff1c4e4815966979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300ccfb782b1b7fe143f0a1f63b3d509bb8174ea6caee999654fe187781b6d216cabd3e07c2cc9c0f65ea14f01548b166b98aca97b2026d91855ee06bfd956b2
|
7
|
+
data.tar.gz: 8cce7bad7e050013c5c798462fdc2099068aae80b8c8a092670597ac1b554cf20e2c7ad56af7e26b48eb904a8edf46a983a707bfed648b5cc4cbe66dbef50a88
|
data/Rakefile
CHANGED
data/great_schools.gemspec
CHANGED
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.required_ruby_version = '>=
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
22
22
|
|
23
|
-
spec.add_development_dependency 'bundler'
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'fakeweb'
|
25
25
|
spec.add_development_dependency 'rake'
|
26
26
|
spec.add_development_dependency 'rspec'
|
27
27
|
|
28
|
-
spec.add_dependency 'activesupport'
|
29
|
-
spec.add_dependency 'httparty'
|
28
|
+
spec.add_dependency 'activesupport'
|
29
|
+
spec.add_dependency 'httparty'
|
30
30
|
end
|
data/lib/great_schools.rb
CHANGED
@@ -2,7 +2,7 @@ module GreatSchools # :nodoc:
|
|
2
2
|
class Version # :nodoc:
|
3
3
|
MAJOR = 0 # version when you make incompatible API changes
|
4
4
|
MINOR = 2 # version when you add functionality in a backwards-compatible manner
|
5
|
-
PATCH =
|
5
|
+
PATCH = 3 # version when you make backwards-compatible bug fixes
|
6
6
|
|
7
7
|
class << self # Class methods
|
8
8
|
# MAJOR.MINOR.PATCH per Semantic Versioning 2.0.0
|
@@ -6,22 +6,22 @@ describe GreatSchools::Census do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_census_data.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/school/census/ND/20?key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
census = GreatSchools::Census.for_school('ND', 20)
|
12
|
-
census.school_name.
|
13
|
-
census.address.
|
14
|
-
census.latitude.
|
15
|
-
census.longitude.
|
16
|
-
census.phone.
|
17
|
-
census.type.
|
18
|
-
census.district.
|
19
|
-
census.enrollment.
|
20
|
-
census.free_and_reduced_price_lunch.
|
21
|
-
census.student_teacher_ratio.
|
12
|
+
expect(census.school_name).to eq('Simle Middle School')
|
13
|
+
expect(census.address).to eq('1215 N 19th St, Bismarck, ND 58501')
|
14
|
+
expect(census.latitude).to eq('46.8179')
|
15
|
+
expect(census.longitude).to eq('-100.7631')
|
16
|
+
expect(census.phone).to eq('(701) 221-3570')
|
17
|
+
expect(census.type).to eq('public')
|
18
|
+
expect(census.district).to eq('Bismarck 1')
|
19
|
+
expect(census.enrollment).to eq('851')
|
20
|
+
expect(census.free_and_reduced_price_lunch).to eq('23.3843')
|
21
|
+
expect(census.student_teacher_ratio).to eq('14.1')
|
22
22
|
|
23
23
|
census.ethnicities.each do |ethnicity|
|
24
|
-
ethnicity.
|
24
|
+
expect(ethnicity).to be_a(GreatSchools::Ethnicity)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -6,25 +6,25 @@ describe GreatSchools::Census do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'nearby_cities.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/cities/nearby/CA/Bakersfield?radius=16&key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
cities = GreatSchools::City.nearby('CA', 'Bakersfield', radius: 16)
|
12
12
|
|
13
|
-
cities.size.
|
14
|
-
cities[0].name.
|
15
|
-
cities[1].name.
|
13
|
+
expect(cities.size).to eq(2)
|
14
|
+
expect(cities[0].name).to eq('Lamont')
|
15
|
+
expect(cities[1].name).to eq('Arvin')
|
16
16
|
|
17
17
|
city = cities.first
|
18
|
-
city.state.
|
19
|
-
city.name.
|
20
|
-
city.rating.
|
21
|
-
city.total_schools.
|
22
|
-
city.elementary_schools.
|
23
|
-
city.middle_schools.
|
24
|
-
city.high_schools.
|
25
|
-
city.public_schools.
|
26
|
-
city.charter_schools.
|
27
|
-
city.private_schools.
|
18
|
+
expect(city.state).to eq('CA')
|
19
|
+
expect(city.name).to eq('Lamont')
|
20
|
+
expect(city.rating).to eq('3')
|
21
|
+
expect(city.total_schools).to eq('5')
|
22
|
+
expect(city.elementary_schools).to eq('3')
|
23
|
+
expect(city.middle_schools).to eq('2')
|
24
|
+
expect(city.high_schools).to eq('1')
|
25
|
+
expect(city.public_schools).to eq('5')
|
26
|
+
expect(city.charter_schools).to eq('0')
|
27
|
+
expect(city.private_schools).to eq('0')
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -33,20 +33,20 @@ describe GreatSchools::Census do
|
|
33
33
|
xml = File.read(File.expand_path(
|
34
34
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'city_overview.xml')
|
35
35
|
))
|
36
|
-
FakeWeb.register_uri(:get, '
|
36
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/cities/AK/Anchorage?key=0123456789ABCDEF', body: xml)
|
37
37
|
|
38
38
|
city = GreatSchools::City.overview('AK', 'Anchorage')
|
39
39
|
|
40
|
-
city.state.
|
41
|
-
city.name.
|
42
|
-
city.rating.
|
43
|
-
city.total_schools.
|
44
|
-
city.elementary_schools.
|
45
|
-
city.middle_schools.
|
46
|
-
city.high_schools.
|
47
|
-
city.public_schools.
|
48
|
-
city.charter_schools.
|
49
|
-
city.private_schools.
|
40
|
+
expect(city.state).to eq('AK')
|
41
|
+
expect(city.name).to eq('Anchorage')
|
42
|
+
expect(city.rating).to eq('7')
|
43
|
+
expect(city.total_schools).to eq('103')
|
44
|
+
expect(city.elementary_schools).to eq('76')
|
45
|
+
expect(city.middle_schools).to eq('41')
|
46
|
+
expect(city.high_schools).to eq('33')
|
47
|
+
expect(city.public_schools).to eq('74')
|
48
|
+
expect(city.charter_schools).to eq('6')
|
49
|
+
expect(city.private_schools).to eq('23')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,7 +54,7 @@ describe GreatSchools::Census do
|
|
54
54
|
it 'should make a GreatSchools::District#browse call using the state/city attributes' do
|
55
55
|
city = GreatSchools::City.new(state: 'IL', city: 'Chicago')
|
56
56
|
|
57
|
-
GreatSchools::District.
|
57
|
+
expect(GreatSchools::District).to receive(:browse).with('IL', 'Chicago')
|
58
58
|
|
59
59
|
city.districts
|
60
60
|
end
|
@@ -64,7 +64,7 @@ describe GreatSchools::Census do
|
|
64
64
|
it 'should make a GreatSchools::Review#for_city call using the state/city attributes' do
|
65
65
|
city = GreatSchools::City.new(state: 'IL', name: 'Chicago')
|
66
66
|
|
67
|
-
GreatSchools::Review.
|
67
|
+
expect(GreatSchools::Review).to receive(:for_city).with('IL', 'Chicago', {})
|
68
68
|
|
69
69
|
city.reviews
|
70
70
|
end
|
@@ -6,29 +6,29 @@ describe GreatSchools::District do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'browse_districts.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/districts/CA/San-Francisco?key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
districts = GreatSchools::District.browse('CA', 'San Francisco')
|
12
12
|
|
13
|
-
districts.size.
|
14
|
-
districts[0].name.
|
15
|
-
districts[1].name.
|
13
|
+
expect(districts.size).to eql(2)
|
14
|
+
expect(districts[0].name).to eql('San Francisco Unified School District')
|
15
|
+
expect(districts[1].name).to eql('San Francisco County Office of Education')
|
16
16
|
|
17
17
|
district = districts.first
|
18
|
-
district.name.
|
19
|
-
district.nces_code.
|
20
|
-
district.district_rating.
|
21
|
-
district.address.
|
22
|
-
district.phone.
|
23
|
-
district.fax.
|
24
|
-
district.website.
|
25
|
-
district.grade_range.
|
26
|
-
district.total_schools.
|
27
|
-
district.elementary_schools.
|
28
|
-
district.middle_schools.
|
29
|
-
district.high_schools.
|
30
|
-
district.public_schools.
|
31
|
-
district.charter_schools.
|
18
|
+
expect(district.name).to eql('San Francisco Unified School District')
|
19
|
+
expect(district.nces_code).to eql('0634410')
|
20
|
+
expect(district.district_rating).to eql('6')
|
21
|
+
expect(district.address).to eql('555 Franklin St., San Francisco, CA 94102')
|
22
|
+
expect(district.phone).to eql('(415) 241-6000')
|
23
|
+
expect(district.fax).to eql('(415) 241-6012')
|
24
|
+
expect(district.website).to eql('http://www.sfusd.k12.ca.us')
|
25
|
+
expect(district.grade_range).to eql('K-12 & ungraded')
|
26
|
+
expect(district.total_schools).to eql('121')
|
27
|
+
expect(district.elementary_schools).to eql('84')
|
28
|
+
expect(district.middle_schools).to eql('36')
|
29
|
+
expect(district.high_schools).to eql('34')
|
30
|
+
expect(district.public_schools).to eql('113')
|
31
|
+
expect(district.charter_schools).to eql('8')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -5,13 +5,13 @@ describe GreatSchools::Ethnicity do
|
|
5
5
|
xml = File.read(File.expand_path(
|
6
6
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_census_data.xml')
|
7
7
|
))
|
8
|
-
FakeWeb.register_uri(:get, '
|
8
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/school/census/ND/20?key=0123456789ABCDEF', body: xml)
|
9
9
|
|
10
10
|
census = GreatSchools::Census.for_school('ND', 20)
|
11
11
|
ethnicity = census.ethnicities.first
|
12
12
|
|
13
|
-
ethnicity.name.
|
14
|
-
ethnicity.value.
|
15
|
-
ethnicity.year.
|
13
|
+
expect(ethnicity.name).to eql('White, non-Hispanic')
|
14
|
+
expect(ethnicity.value).to eql('91.0693')
|
15
|
+
expect(ethnicity.year).to eql('2007')
|
16
16
|
end
|
17
17
|
end
|
@@ -6,16 +6,16 @@ describe GreatSchools::Score do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_test_scores.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/school/tests/AZ/1?key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
score = GreatSchools::Score.for_school('AZ', 1)
|
12
12
|
rank = score.rank
|
13
13
|
|
14
|
-
rank.name.
|
15
|
-
rank.scale.
|
16
|
-
rank.year.
|
17
|
-
rank.score.
|
18
|
-
rank.description.
|
14
|
+
expect(rank.name).to eql('AZ GS Rating')
|
15
|
+
expect(rank.scale).to eql('1-10')
|
16
|
+
expect(rank.year).to eql('2008')
|
17
|
+
expect(rank.score).to eql('9.0')
|
18
|
+
expect(rank.description).to eql(<<-TEXT.squish)
|
19
19
|
GreatSchools Ratings for Arizona are based on the 2007-2008 Arizona's
|
20
20
|
Instrument to Measure Standards (AIMS) reading, writing and math results.
|
21
21
|
GreatSchools compared the test results for each grade and subject across
|
@@ -6,21 +6,21 @@ describe GreatSchools::Score do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_test_scores.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/school/tests/AZ/1?key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
score = GreatSchools::Score.for_school('AZ', 1)
|
12
12
|
results = score.tests.first.results
|
13
13
|
|
14
|
-
results.size.
|
15
|
-
results[0].subject_name.
|
16
|
-
results[1].subject_name.
|
14
|
+
expect(results.size).to eql(2)
|
15
|
+
expect(results[0].subject_name).to eql('Writing')
|
16
|
+
expect(results[1].subject_name).to eql('Reading')
|
17
17
|
|
18
18
|
result = results.first
|
19
|
-
result.grade_name.
|
20
|
-
result.score.
|
21
|
-
result.subject_name.
|
22
|
-
result.test_id.
|
23
|
-
result.year.
|
19
|
+
expect(result.grade_name).to eql('10')
|
20
|
+
expect(result.score).to eql('81.0')
|
21
|
+
expect(result.subject_name).to eql('Writing')
|
22
|
+
expect(result.test_id).to eql('AZ00137')
|
23
|
+
expect(result.year).to eql('2008')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -6,22 +6,22 @@ describe GreatSchools::Review do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_reviews.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/reviews/city/CA/Alameda?limit=2&key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
reviews = GreatSchools::Review.for_city('CA', 'Alameda', limit: 2)
|
12
12
|
|
13
|
-
reviews.size.
|
14
|
-
reviews[0].submitter.
|
15
|
-
reviews[1].submitter.
|
13
|
+
expect(reviews.size).to eql(2)
|
14
|
+
expect(reviews[0].submitter).to eql('former student')
|
15
|
+
expect(reviews[1].submitter).to eql('parent')
|
16
16
|
|
17
17
|
review = reviews.first
|
18
|
-
review.school_name.
|
19
|
-
review.school_address.
|
20
|
-
review.review_link.
|
21
|
-
review.rating.
|
22
|
-
review.submitter.
|
23
|
-
review.posted_date.
|
24
|
-
review.comments.
|
18
|
+
expect(review.school_name).to eql('Alameda High School')
|
19
|
+
expect(review.school_address).to eql('2201 Encinal Ave., Alameda, CA 94501')
|
20
|
+
expect(review.review_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=1&s_cid=gsapi&lr=true#ps398220')
|
21
|
+
expect(review.rating).to eql('3')
|
22
|
+
expect(review.submitter).to eql('former student')
|
23
|
+
expect(review.posted_date).to eql('2006/06/06')
|
24
|
+
expect(review.comments).to eql('The staff gets on the level of the students and everything is kaotic.')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -30,22 +30,22 @@ describe GreatSchools::Review do
|
|
30
30
|
xml = File.read(File.expand_path(
|
31
31
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_reviews.xml')
|
32
32
|
))
|
33
|
-
FakeWeb.register_uri(:get, '
|
33
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/reviews/school/CA/1?limit=2&key=0123456789ABCDEF', body: xml)
|
34
34
|
|
35
35
|
reviews = GreatSchools::Review.for_school('CA', 1, limit: 2)
|
36
36
|
|
37
|
-
reviews.size.
|
38
|
-
reviews[0].submitter.
|
39
|
-
reviews[1].submitter.
|
37
|
+
expect(reviews.size).to eql(2)
|
38
|
+
expect(reviews[0].submitter).to eql('former student')
|
39
|
+
expect(reviews[1].submitter).to eql('parent')
|
40
40
|
|
41
41
|
review = reviews.first
|
42
|
-
review.school_name.
|
43
|
-
review.school_address.
|
44
|
-
review.review_link.
|
45
|
-
review.rating.
|
46
|
-
review.submitter.
|
47
|
-
review.posted_date.
|
48
|
-
review.comments.
|
42
|
+
expect(review.school_name).to eql('Alameda High School')
|
43
|
+
expect(review.school_address).to eql('2201 Encinal Ave., Alameda, CA 94501')
|
44
|
+
expect(review.review_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=1&s_cid=gsapi&lr=true#ps398220')
|
45
|
+
expect(review.rating).to eql('3')
|
46
|
+
expect(review.submitter).to eql('former student')
|
47
|
+
expect(review.posted_date).to eql('2006/06/06')
|
48
|
+
expect(review.comments).to eql('The staff gets on the level of the students and everything is kaotic.')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -53,20 +53,20 @@ describe GreatSchools::Review do
|
|
53
53
|
xml = File.read(File.expand_path(
|
54
54
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_profile.xml')
|
55
55
|
))
|
56
|
-
FakeWeb.register_uri(:get, '
|
56
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/schools/CA/1?key=0123456789ABCDEF', body: xml)
|
57
57
|
|
58
58
|
school = GreatSchools::School.profile('CA', 1)
|
59
59
|
reviews = school.parent_reviews
|
60
60
|
|
61
|
-
reviews.size.
|
61
|
+
expect(reviews.size).to eql(5)
|
62
62
|
|
63
63
|
review = reviews.first
|
64
|
-
review.school_name.
|
65
|
-
review.school_address.
|
66
|
-
review.review_link.
|
67
|
-
review.rating.
|
68
|
-
review.submitter.
|
69
|
-
review.posted_date.
|
70
|
-
review.comments.
|
64
|
+
expect(review.school_name).to eql('Alameda High School')
|
65
|
+
expect(review.school_address).to eql('2201 Encinal Ave., Alameda, CA 94501')
|
66
|
+
expect(review.review_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=1&s_cid=gsapi&lr=true#ps398220')
|
67
|
+
expect(review.rating).to eql('3')
|
68
|
+
expect(review.submitter).to eql('former student')
|
69
|
+
expect(review.posted_date).to eql('2006/06/06')
|
70
|
+
expect(review.comments).to eql('The staff gets on the level of the students and everything is kaotic.')
|
71
71
|
end
|
72
72
|
end
|
@@ -6,45 +6,45 @@ describe GreatSchools::School do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'browse_schools.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/schools/CA/Truckee?limit=2&key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
schools = GreatSchools::School.browse('CA', 'Truckee', limit: 2)
|
12
12
|
|
13
|
-
schools.size.
|
14
|
-
schools[0].name.
|
15
|
-
schools[1].name.
|
13
|
+
expect(schools.size).to eql(2)
|
14
|
+
expect(schools[0].name).to eql('Alder Creek Middle School')
|
15
|
+
expect(schools[1].name).to eql('Cold Stream Alternative School')
|
16
16
|
|
17
17
|
school = schools.first
|
18
|
-
school.id.
|
19
|
-
school.name.
|
20
|
-
school.type.
|
21
|
-
school.grade_range.
|
22
|
-
school.enrollment.
|
23
|
-
school.rating.
|
24
|
-
school.parent_rating.
|
25
|
-
school.city.
|
26
|
-
school.state.
|
27
|
-
school.district_id.
|
28
|
-
school.district.
|
29
|
-
school.district_nces_id.
|
30
|
-
school.address.
|
31
|
-
school.phone.
|
32
|
-
school.fax.
|
33
|
-
school.website.
|
34
|
-
school.nces_id.
|
35
|
-
school.latitude.
|
36
|
-
school.longitude.
|
37
|
-
school.overview_link.
|
38
|
-
school.ratings_link.
|
39
|
-
school.reviews_link.
|
40
|
-
school.school_stats_link.
|
18
|
+
expect(school.id).to eql('13978')
|
19
|
+
expect(school.name).to eql('Alder Creek Middle School')
|
20
|
+
expect(school.type).to eql('public')
|
21
|
+
expect(school.grade_range).to eql('6-8')
|
22
|
+
expect(school.enrollment).to eql('598')
|
23
|
+
expect(school.rating).to eql('8')
|
24
|
+
expect(school.parent_rating).to eql('4')
|
25
|
+
expect(school.city).to eql('Truckee')
|
26
|
+
expect(school.state).to eql('CA')
|
27
|
+
expect(school.district_id).to eql('509')
|
28
|
+
expect(school.district).to eql('Tahoe-Truckee Joint Unified School District')
|
29
|
+
expect(school.district_nces_id).to eql('0638770')
|
30
|
+
expect(school.address).to eql('10931 Alder Dr., Truckee, CA 96161')
|
31
|
+
expect(school.phone).to eql('(530) 582-2750')
|
32
|
+
expect(school.fax).to eql('(530) 582-7640')
|
33
|
+
expect(school.website).to eql('http://www.ttusd.org')
|
34
|
+
expect(school.nces_id).to eql('063877011005')
|
35
|
+
expect(school.latitude).to eql('39.3454')
|
36
|
+
expect(school.longitude).to eql('-120.1735')
|
37
|
+
expect(school.overview_link).to eql('http://www.greatschools.org/modperl/browse_school/ca/13978?s_cid=gsapi')
|
38
|
+
expect(school.ratings_link).to eql('http://www.greatschools.org/school/rating.page?state=CA&id=13978&s_cid=gsapi')
|
39
|
+
expect(school.reviews_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=13978&s_cid=gsapi')
|
40
|
+
expect(school.school_stats_link).to eql('http://www.greatschools.org/cgi-bin/CA/otherprivate/13978')
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should return an empty array if the server response with no data (404)' do
|
44
|
-
FakeWeb.register_uri(:get, '
|
44
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/schools/AS/Pago-Pago?limit=2&key=0123456789ABCDEF', body: nil, status: ['404', 'Not Found'])
|
45
45
|
|
46
46
|
schools = GreatSchools::School.browse('AS', 'Pago Pago', limit: 2)
|
47
|
-
schools.size.
|
47
|
+
expect(schools.size).to eql(0)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -53,41 +53,41 @@ describe GreatSchools::School do
|
|
53
53
|
xml = File.read(File.expand_path(
|
54
54
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'nearby_schools.xml')
|
55
55
|
))
|
56
|
-
FakeWeb.register_uri(:get, '
|
56
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/schools/nearby?state=CA&zip=94105&limit=2&key=0123456789ABCDEF', body: xml)
|
57
57
|
|
58
58
|
schools = GreatSchools::School.nearby('CA', zip_code: 94105, limit: 2)
|
59
59
|
|
60
|
-
schools.size.
|
61
|
-
schools[0].name.
|
62
|
-
schools[1].name.
|
60
|
+
expect(schools.size).to eql(2)
|
61
|
+
expect(schools[0].name).to eql('Youth Chance High School')
|
62
|
+
expect(schools[1].name).to eql('Notre Dame des Victoires School')
|
63
63
|
|
64
64
|
school = schools.first
|
65
|
-
school.id.
|
66
|
-
school.name.
|
67
|
-
school.type.
|
68
|
-
school.grade_range.
|
69
|
-
school.enrollment.
|
70
|
-
school.city.
|
71
|
-
school.state.
|
72
|
-
school.address.
|
73
|
-
school.phone.
|
74
|
-
school.nces_id.
|
75
|
-
school.latitude.
|
76
|
-
school.longitude.
|
77
|
-
school.overview_link.
|
78
|
-
school.ratings_link.
|
79
|
-
school.reviews_link.
|
65
|
+
expect(school.id).to eql('11536')
|
66
|
+
expect(school.name).to eql('Youth Chance High School')
|
67
|
+
expect(school.type).to eql('private')
|
68
|
+
expect(school.grade_range).to eql('10-12')
|
69
|
+
expect(school.enrollment).to eql('25')
|
70
|
+
expect(school.city).to eql('San Francisco')
|
71
|
+
expect(school.state).to eql('CA')
|
72
|
+
expect(school.address).to eql('169 Steuart Street, San Francisco, CA 94105')
|
73
|
+
expect(school.phone).to eql('(415) 615-1337')
|
74
|
+
expect(school.nces_id).to eql('A9900759')
|
75
|
+
expect(school.latitude).to eql('37.7924')
|
76
|
+
expect(school.longitude).to eql('-122.3921')
|
77
|
+
expect(school.overview_link).to eql('http://www.greatschools.org/cgi-bin/ca/private/11536?s_cid=gsapi')
|
78
|
+
expect(school.ratings_link).to eql('http://www.greatschools.org/school/rating.page?state=CA&id=11536&s_cid=gsapi')
|
79
|
+
expect(school.reviews_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=11536&s_cid=gsapi')
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'should handle no results coming back from the web service' do
|
83
83
|
xml = File.read(File.expand_path(
|
84
84
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'nearby_schools_empty.xml')
|
85
85
|
))
|
86
|
-
FakeWeb.register_uri(:get, '
|
86
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/schools/nearby?state=CA&zip=00000&limit=2&key=0123456789ABCDEF', body: xml)
|
87
87
|
|
88
88
|
schools = GreatSchools::School.nearby('CA', zip_code: '00000', limit: 2)
|
89
89
|
|
90
|
-
schools.size.
|
90
|
+
expect(schools.size).to eql(0)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -96,33 +96,33 @@ describe GreatSchools::School do
|
|
96
96
|
xml = File.read(File.expand_path(
|
97
97
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_profile.xml')
|
98
98
|
))
|
99
|
-
FakeWeb.register_uri(:get, '
|
99
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/schools/CA/1?key=0123456789ABCDEF', body: xml)
|
100
100
|
|
101
101
|
school = GreatSchools::School.profile('CA', 1)
|
102
102
|
|
103
|
-
school.id.
|
104
|
-
school.name.
|
105
|
-
school.type.
|
106
|
-
school.grade_range.
|
107
|
-
school.enrollment.
|
108
|
-
school.city.
|
109
|
-
school.state.
|
110
|
-
school.district_id.
|
111
|
-
school.district.
|
112
|
-
school.district_nces_id.
|
113
|
-
school.address.
|
114
|
-
school.phone.
|
115
|
-
school.fax.
|
116
|
-
school.website.
|
117
|
-
school.nces_id.
|
118
|
-
school.latitude.
|
119
|
-
school.longitude.
|
120
|
-
school.overview_link.
|
121
|
-
school.ratings_link.
|
122
|
-
school.reviews_link.
|
103
|
+
expect(school.id).to eql('1')
|
104
|
+
expect(school.name).to eql('Alameda High School')
|
105
|
+
expect(school.type).to eql('public')
|
106
|
+
expect(school.grade_range).to eql('9-12')
|
107
|
+
expect(school.enrollment).to eql('1938')
|
108
|
+
expect(school.city).to eql('Alameda')
|
109
|
+
expect(school.state).to eql('CA')
|
110
|
+
expect(school.district_id).to eql('1')
|
111
|
+
expect(school.district).to eql('Alameda City Unified School District')
|
112
|
+
expect(school.district_nces_id).to eql('0601770')
|
113
|
+
expect(school.address).to eql('2201 Encinal Ave., Alameda, CA 94501')
|
114
|
+
expect(school.phone).to eql('(510) 337-7022')
|
115
|
+
expect(school.fax).to eql('(510) 521-4740')
|
116
|
+
expect(school.website).to eql('http://ahs.alameda.k12.ca.us/')
|
117
|
+
expect(school.nces_id).to eql('060177000041')
|
118
|
+
expect(school.latitude).to eql('37.764267')
|
119
|
+
expect(school.longitude).to eql('-122.24818')
|
120
|
+
expect(school.overview_link).to eql('http://www.greatschools.org/modperl/browse_school/ca/1?s_cid=gsapi')
|
121
|
+
expect(school.ratings_link).to eql('http://www.greatschools.org/school/rating.page?state=CA&id=1&s_cid=gsapi')
|
122
|
+
expect(school.reviews_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=1&s_cid=gsapi')
|
123
123
|
|
124
124
|
school.parent_reviews.each do |review|
|
125
|
-
review.
|
125
|
+
expect(review).to be_a(GreatSchools::Review)
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
@@ -132,31 +132,31 @@ describe GreatSchools::School do
|
|
132
132
|
xml = File.read(File.expand_path(
|
133
133
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_search.xml')
|
134
134
|
))
|
135
|
-
FakeWeb.register_uri(:get, '
|
135
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/search/schools?limit=2&q=Alameda%20Christian&state=CA&key=0123456789ABCDEF', body: xml)
|
136
136
|
|
137
137
|
schools = GreatSchools::School.search('CA', 'Alameda Christian', limit: 2)
|
138
138
|
|
139
|
-
schools.size.
|
140
|
-
schools[0].name.
|
141
|
-
schools[1].name.
|
139
|
+
expect(schools.size).to eql(2)
|
140
|
+
expect(schools[0].name).to eql('Alameda Christian School')
|
141
|
+
expect(schools[1].name).to eql('Chinese Christian Schools-Alameda')
|
142
142
|
|
143
143
|
school = schools.first
|
144
|
-
school.id.
|
145
|
-
school.name.
|
146
|
-
school.type.
|
147
|
-
school.grade_range.
|
148
|
-
school.enrollment.
|
149
|
-
school.parent_rating.
|
150
|
-
school.city.
|
151
|
-
school.state.
|
152
|
-
school.address.
|
153
|
-
school.phone.
|
154
|
-
school.nces_id.
|
155
|
-
school.latitude.
|
156
|
-
school.longitude.
|
157
|
-
school.overview_link.
|
158
|
-
school.ratings_link.
|
159
|
-
school.reviews_link.
|
144
|
+
expect(school.id).to eql('8485')
|
145
|
+
expect(school.name).to eql('Alameda Christian School')
|
146
|
+
expect(school.type).to eql('private')
|
147
|
+
expect(school.grade_range).to eql('K-8')
|
148
|
+
expect(school.enrollment).to eql('52')
|
149
|
+
expect(school.parent_rating).to eql('5')
|
150
|
+
expect(school.city).to eql('Alameda')
|
151
|
+
expect(school.state).to eql('CA')
|
152
|
+
expect(school.address).to eql('2226 Pacific Ave, Alameda, CA 94501')
|
153
|
+
expect(school.phone).to eql('(510) 523-1000')
|
154
|
+
expect(school.nces_id).to eql('00079445')
|
155
|
+
expect(school.latitude).to eql('37.768623')
|
156
|
+
expect(school.longitude).to eql('-122.243965')
|
157
|
+
expect(school.overview_link).to eql('http://www.greatschools.org/cgi-bin/ca/private/8485?s_cid=gsapi')
|
158
|
+
expect(school.ratings_link).to eql('http://www.greatschools.org/school/rating.page?state=CA&id=8485&s_cid=gsapi')
|
159
|
+
expect(school.reviews_link).to eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=8485&s_cid=gsapi')
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -164,7 +164,7 @@ describe GreatSchools::School do
|
|
164
164
|
|
165
165
|
describe '.census' do
|
166
166
|
it 'should make a GreatSchools::Census#for_school call using state/gs_id attributes' do
|
167
|
-
GreatSchools::Census.
|
167
|
+
expect(GreatSchools::Census).to receive(:for_school).with('CA', 1)
|
168
168
|
|
169
169
|
school.census
|
170
170
|
end
|
@@ -172,7 +172,7 @@ describe GreatSchools::School do
|
|
172
172
|
|
173
173
|
describe '.reviews' do
|
174
174
|
it 'should make a GreatSchools::Review#for_school call using state/gs_id attributes' do
|
175
|
-
GreatSchools::Review.
|
175
|
+
expect(GreatSchools::Review).to receive(:for_school).with('CA', 1, {})
|
176
176
|
|
177
177
|
school.reviews
|
178
178
|
end
|
@@ -180,7 +180,7 @@ describe GreatSchools::School do
|
|
180
180
|
|
181
181
|
describe '.score' do
|
182
182
|
it 'should make a GreatSchools::Score#for_school call using state/gs_id attributes' do
|
183
|
-
GreatSchools::Score.
|
183
|
+
expect(GreatSchools::Score).to receive(:for_school).with('CA', 1)
|
184
184
|
|
185
185
|
school.score
|
186
186
|
end
|
@@ -6,14 +6,14 @@ describe GreatSchools::Score do
|
|
6
6
|
xml = File.read(File.expand_path(
|
7
7
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_test_scores.xml')
|
8
8
|
))
|
9
|
-
FakeWeb.register_uri(:get, '
|
9
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/school/tests/AZ/1?key=0123456789ABCDEF', body: xml)
|
10
10
|
|
11
11
|
score = GreatSchools::Score.for_school('AZ', 1)
|
12
12
|
|
13
|
-
score.school_name.
|
14
|
-
score.rank.
|
13
|
+
expect(score.school_name).to eql('Flagstaff High School')
|
14
|
+
expect(score.rank).to be_a(GreatSchools::Rank)
|
15
15
|
score.tests.each do |test|
|
16
|
-
test.
|
16
|
+
expect(test).to be_a(GreatSchools::Test)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -5,20 +5,20 @@ describe GreatSchools::Test do
|
|
5
5
|
xml = File.read(File.expand_path(
|
6
6
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_test_scores.xml')
|
7
7
|
))
|
8
|
-
FakeWeb.register_uri(:get, '
|
8
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/school/tests/AZ/1?key=0123456789ABCDEF', body: xml)
|
9
9
|
|
10
10
|
score = GreatSchools::Score.for_school('AZ', 1)
|
11
11
|
tests = score.tests
|
12
12
|
|
13
|
-
tests.size.
|
13
|
+
expect(tests.size).to eql(1)
|
14
14
|
|
15
15
|
test = tests.first
|
16
|
-
test.name.
|
17
|
-
test.id.
|
18
|
-
test.abbreviation.
|
19
|
-
test.scale.
|
20
|
-
test.level_code.
|
21
|
-
test.description.
|
16
|
+
expect(test.name).to eql('Arizona\'s Instrument to Measure Standards')
|
17
|
+
expect(test.id).to eql('AZ00137')
|
18
|
+
expect(test.abbreviation).to eql('AIMS')
|
19
|
+
expect(test.scale).to eql('% meeting or exceeding standards')
|
20
|
+
expect(test.level_code).to eql('e,m,h')
|
21
|
+
expect(test.description).to eql(<<-TEXT.squish)
|
22
22
|
In 2007-2008 Arizona's Instrument to Measure Standards (AIMS) was used to
|
23
23
|
test students in reading, writing and mathematics in grades 3 through 8
|
24
24
|
and 10, and in science in grades 4, 8 and high school. AIMS is a
|
@@ -29,7 +29,7 @@ describe GreatSchools::Test do
|
|
29
29
|
TEXT
|
30
30
|
|
31
31
|
test.results.each do |result|
|
32
|
-
result.
|
32
|
+
expect(result).to be_a(GreatSchools::Result)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/spec/great_schools_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe GreatSchools::API do
|
|
5
5
|
xml = File.read(File.expand_path(
|
6
6
|
File.join(File.dirname(__FILE__), 'fixtures', 'error.xml')
|
7
7
|
))
|
8
|
-
FakeWeb.register_uri(:get, '
|
8
|
+
FakeWeb.register_uri(:get, 'https://api.greatschools.org/reviews/city/CA/Foster-City?key=0123456789ABCDEF', body: xml, status: [401, 'Unauthorized'])
|
9
9
|
|
10
10
|
expect {
|
11
11
|
GreatSchools::API.get('reviews/city/CA/Foster-City')
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: great_schools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael J. Sepcot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fakeweb
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: httparty
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
96
|
+
version: '0'
|
97
97
|
description: The GreatSchools API allows access to School Profiles, Test Scores, School
|
98
98
|
Reviews, GreatSchools Ratings, School Districts, and City Profiles.
|
99
99
|
email:
|
@@ -158,15 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
158
|
requirements:
|
159
159
|
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: 2.0.0
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
|
-
|
169
|
-
rubygems_version: 2.2.2
|
168
|
+
rubygems_version: 3.0.6
|
170
169
|
signing_key:
|
171
170
|
specification_version: 4
|
172
171
|
summary: A Ruby interface to the GreatSchools API.
|