great_schools 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +58 -0
  6. data/Rakefile +6 -0
  7. data/great_schools.gemspec +28 -0
  8. data/lib/great_schools.rb +88 -0
  9. data/lib/great_schools/census.rb +52 -0
  10. data/lib/great_schools/city.rb +72 -0
  11. data/lib/great_schools/district.rb +29 -0
  12. data/lib/great_schools/error.rb +51 -0
  13. data/lib/great_schools/ethnicity.rb +5 -0
  14. data/lib/great_schools/model.rb +45 -0
  15. data/lib/great_schools/rank.rb +5 -0
  16. data/lib/great_schools/result.rb +5 -0
  17. data/lib/great_schools/review.rb +47 -0
  18. data/lib/great_schools/school.rb +177 -0
  19. data/lib/great_schools/score.rb +47 -0
  20. data/lib/great_schools/test.rb +22 -0
  21. data/lib/great_schools/version.rb +14 -0
  22. data/spec/fixtures/browse_districts.xml +35 -0
  23. data/spec/fixtures/browse_schools.xml +46 -0
  24. data/spec/fixtures/city_overview.xml +12 -0
  25. data/spec/fixtures/error.xml +7 -0
  26. data/spec/fixtures/nearby_cities.xml +25 -0
  27. data/spec/fixtures/nearby_schools.xml +37 -0
  28. data/spec/fixtures/school_census_data.xml +40 -0
  29. data/spec/fixtures/school_profile.xml +70 -0
  30. data/spec/fixtures/school_reviews.xml +21 -0
  31. data/spec/fixtures/school_search.xml +38 -0
  32. data/spec/fixtures/school_test_scores.xml +33 -0
  33. data/spec/great_schools/census_spec.rb +28 -0
  34. data/spec/great_schools/city_spec.rb +72 -0
  35. data/spec/great_schools/district_spec.rb +34 -0
  36. data/spec/great_schools/ethnicity_spec.rb +17 -0
  37. data/spec/great_schools/rank_spec.rb +33 -0
  38. data/spec/great_schools/result_spec.rb +26 -0
  39. data/spec/great_schools/review_spec.rb +72 -0
  40. data/spec/great_schools/school_spec.rb +167 -0
  41. data/spec/great_schools/score_spec.rb +20 -0
  42. data/spec/great_schools/test_spec.rb +35 -0
  43. data/spec/great_schools_spec.rb +14 -0
  44. data/spec/spec_helper.rb +18 -0
  45. metadata +195 -0
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <city>
3
+ <name>Anchorage</name>
4
+ <rating>7</rating>
5
+ <totalSchools>103</totalSchools>
6
+ <elementarySchools>76</elementarySchools>
7
+ <middleSchools>41</middleSchools>
8
+ <highSchools>33</highSchools>
9
+ <publicSchools>74</publicSchools>
10
+ <charterSchools>6</charterSchools>
11
+ <privateSchools>23</privateSchools>
12
+ </city>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <error>
3
+ <errorCode>3</errorCode>
4
+ <faultString>Invalid API key.</faultString>
5
+ <date>2013/11/14</date>
6
+ <call>/reviews/city/CA/Foster-City</call>
7
+ </error>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <cities>
3
+ <city>
4
+ <name>Lamont</name>
5
+ <rating>3</rating>
6
+ <totalSchools>5</totalSchools>
7
+ <elementarySchools>3</elementarySchools>
8
+ <middleSchools>2</middleSchools>
9
+ <highSchools>1</highSchools>
10
+ <publicSchools>5</publicSchools>
11
+ <charterSchools>0</charterSchools>
12
+ <privateSchools>0</privateSchools>
13
+ </city>
14
+ <city>
15
+ <name>Arvin</name>
16
+ <rating>3</rating>
17
+ <totalSchools>6</totalSchools>
18
+ <elementarySchools>4</elementarySchools>
19
+ <middleSchools>2</middleSchools>
20
+ <highSchools>1</highSchools>
21
+ <publicSchools>6</publicSchools>
22
+ <charterSchools>0</charterSchools>
23
+ <privateSchools>0</privateSchools>
24
+ </city>
25
+ </cities>
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <schools>
3
+ <school>
4
+ <gsId>11536</gsId>
5
+ <name>Youth Chance High School</name>
6
+ <type>private</type>
7
+ <gradeRange>10-12</gradeRange>
8
+ <enrollment>25</enrollment>
9
+ <city>San Francisco</city>
10
+ <state>CA</state>
11
+ <address>169 Steuart Street, San Francisco, CA 94105</address>
12
+ <phone>(415) 615-1337</phone>
13
+ <ncesId>A9900759</ncesId>
14
+ <lat>37.7924</lat>
15
+ <lon>-122.3921</lon>
16
+ <overviewLink>http://www.greatschools.org/cgi-bin/ca/private/11536?s_cid=gsapi</overviewLink>
17
+ <ratingsLink>http://www.greatschools.org/school/rating.page?state=CA&amp;id=11536&amp;s_cid=gsapi</ratingsLink>
18
+ <reviewsLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=11536&amp;s_cid=gsapi</reviewsLink>
19
+ </school>
20
+ <school>
21
+ <gsId>8097</gsId>
22
+ <name>Notre Dame des Victoires School</name>
23
+ <type>private</type>
24
+ <gradeRange>K-8</gradeRange>
25
+ <enrollment>275</enrollment>
26
+ <city>San Francisco</city>
27
+ <state>CA</state>
28
+ <address>659 Pine St, San Francisco, CA 94108</address>
29
+ <phone>(415) 421-0069</phone>
30
+ <ncesId>00072439</ncesId>
31
+ <lat>37.791412</lat>
32
+ <lon>-122.406784</lon>
33
+ <overviewLink>http://www.greatschools.org/cgi-bin/ca/private/8097?s_cid=gsapi</overviewLink>
34
+ <ratingsLink>http://www.greatschools.org/school/rating.page?state=CA&amp;id=8097&amp;s_cid=gsapi</ratingsLink>
35
+ <reviewsLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=8097&amp;s_cid=gsapi</reviewsLink>
36
+ </school>
37
+ </schools>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <census-data>
3
+ <schoolName>Simle Middle School</schoolName>
4
+ <address>1215 N 19th St, Bismarck, ND 58501</address>
5
+ <latitude>46.8179</latitude>
6
+ <longitude>-100.7631</longitude>
7
+ <phone>(701) 221-3570</phone>
8
+ <type>public</type>
9
+ <district>Bismarck 1</district>
10
+ <enrollment>851</enrollment>
11
+ <freeAndReducedPriceLunch>23.3843</freeAndReducedPriceLunch>
12
+ <studentTeacherRatio>14.1</studentTeacherRatio>
13
+ <ethnicities>
14
+ <ethnicity>
15
+ <name>White, non-Hispanic</name>
16
+ <value>91.0693</value>
17
+ <year>2007</year>
18
+ </ethnicity>
19
+ <ethnicity>
20
+ <name>Black, non-Hispanic</name>
21
+ <value>0.587544</value>
22
+ <year>2007</year>
23
+ </ethnicity>
24
+ <ethnicity>
25
+ <name>Hispanic</name>
26
+ <value>0.822562</value>
27
+ <year>2007</year>
28
+ </ethnicity>
29
+ <ethnicity>
30
+ <name>Asian/Pacific Islander</name>
31
+ <value>0.705053</value>
32
+ <year>2007</year>
33
+ </ethnicity>
34
+ <ethnicity>
35
+ <name>Native American or Native Alaskan</name>
36
+ <value>6.81551</value>
37
+ <year>2007</year>
38
+ </ethnicity>
39
+ </ethnicities>
40
+ </census-data>
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <school>
3
+ <gsId>1</gsId>
4
+ <name>Alameda High School</name>
5
+ <type>public</type>
6
+ <gradeRange>9-12</gradeRange>
7
+ <enrollment>1938</enrollment>
8
+ <city>Alameda</city>
9
+ <state>CA</state>
10
+ <districtId>1</districtId>
11
+ <district>Alameda City Unified School District</district>
12
+ <districtNCESId>0601770</districtNCESId>
13
+ <address>2201 Encinal Ave., Alameda, CA 94501</address>
14
+ <phone>(510) 337-7022</phone>
15
+ <fax>(510) 521-4740</fax>
16
+ <website>http://ahs.alameda.k12.ca.us/</website>
17
+ <ncesId>060177000041</ncesId>
18
+ <lat>37.764267</lat>
19
+ <lon>-122.24818</lon>
20
+ <overviewLink>http://www.greatschools.org/modperl/browse_school/ca/1?s_cid=gsapi</overviewLink>
21
+ <ratingsLink>http://www.greatschools.org/school/rating.page?state=CA&amp;id=1&amp;s_cid=gsapi</ratingsLink>
22
+ <reviewsLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi</reviewsLink>
23
+ <parentReviews>
24
+ <review>
25
+ <schoolName>Alameda High School</schoolName>
26
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
27
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps398220</reviewLink>
28
+ <rating>3</rating>
29
+ <submitter>former student</submitter>
30
+ <postedDate>2006/06/06</postedDate>
31
+ <comments>The staff gets on the level of the students and everything is kaotic.</comments>
32
+ </review>
33
+ <review>
34
+ <schoolName>Alameda High School</schoolName>
35
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
36
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps354422</reviewLink>
37
+ <rating>3</rating>
38
+ <submitter>parent</submitter>
39
+ <postedDate>2006/03/12</postedDate>
40
+ <comments>I have hasd 2 children at Alameda High and I find the school to be 'okay. As a large public high school, with a huge variation of academic abilities, it is extremely important for parents to stay in touch with course choices and expectations of teachers to ensure their child's basic education. Their music and drama programs are excellent - don't know about sports. Easy to lose your way in such a large environment - stay in touch with counselors and teachers.</comments>
41
+ </review>
42
+ <review>
43
+ <schoolName>Alameda High School</schoolName>
44
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
45
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps214510</reviewLink>
46
+ <rating>4</rating>
47
+ <submitter>parent</submitter>
48
+ <postedDate>2005/05/06</postedDate>
49
+ <comments>We just went to Open House at Alameda High, and found the teachers very dedicated. They know their students and were ready to give individual feedback to parents. There is a range of academic levels offered including some very challenging AP classes. Some classes are rather large, but the EXP and AP classes may be smaller. There is a range of students, from those who are not interested in studying, to those who are highly motivated and hard working, with GPA's over 4.0. There is a lot of student involvement in extracurricular activities, such as a poetry anthology they were selling to raise money for the English Dept., a book sale to benefit the media center, a blood drive sponsored by one of the clubs. They have after school sports, an active music dept (the jazz band just performed at Yoshi's), extraodinary drama dept. that puts on several plays each year.</comments>
50
+ </review>
51
+ <review>
52
+ <schoolName>Alameda High School</schoolName>
53
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
54
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps154770</reviewLink>
55
+ <rating>4</rating>
56
+ <submitter>parent</submitter>
57
+ <postedDate>2005/01/04</postedDate>
58
+ <comments>Excellent teachers for AP and HP English and History programs. Good music/choir program. Excellent drama program. Sports-- won league in many sports in 2003-2004.</comments>
59
+ </review>
60
+ <review>
61
+ <schoolName>Alameda High School</schoolName>
62
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
63
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps105868</reviewLink>
64
+ <rating>3</rating>
65
+ <submitter>former student</submitter>
66
+ <postedDate>2004/07/29</postedDate>
67
+ <comments>Good school. Lots of AP classes. But mixed economics makes learning tougher for the non-CP students.</comments>
68
+ </review>
69
+ </parentReviews>
70
+ </school>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <reviews>
3
+ <review>
4
+ <schoolName>Alameda High School</schoolName>
5
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
6
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps398220</reviewLink>
7
+ <rating>3</rating>
8
+ <submitter>former student</submitter>
9
+ <postedDate>2006/06/06</postedDate>
10
+ <comments>The staff gets on the level of the students and everything is kaotic.</comments>
11
+ </review>
12
+ <review>
13
+ <schoolName>Alameda High School</schoolName>
14
+ <schoolAddress>2201 Encinal Ave., Alameda, CA 94501</schoolAddress>
15
+ <reviewLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=1&amp;s_cid=gsapi&amp;lr=true#ps354422</reviewLink>
16
+ <rating>3</rating>
17
+ <submitter>parent</submitter>
18
+ <postedDate>2006/03/12</postedDate>
19
+ <comments>I have hasd 2 children at Alameda High and I find the school to be 'okay. As a large public high school, with a huge variation of academic abilities, it is extremely important for parents to stay in touch with course choices and expectations of teachers to ensure their child's basic education. Their music and drama programs are excellent - don't know about sports. Easy to lose your way in such a large environment - stay in touch with counselors and teachers.</comments>
20
+ </review>
21
+ </reviews>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <schools>
3
+ <school>
4
+ <gsId>8485</gsId>
5
+ <name>Alameda Christian School</name>
6
+ <type>private</type>
7
+ <gradeRange>K-8</gradeRange>
8
+ <enrollment>52</enrollment>
9
+ <parentRating>5</parentRating>
10
+ <city>Alameda</city>
11
+ <state>CA</state>
12
+ <address>2226 Pacific Ave, Alameda, CA 94501</address>
13
+ <phone>(510) 523-1000</phone>
14
+ <ncesId>00079445</ncesId>
15
+ <lat>37.768623</lat>
16
+ <lon>-122.243965</lon>
17
+ <overviewLink>http://www.greatschools.org/cgi-bin/ca/private/8485?s_cid=gsapi</overviewLink>
18
+ <ratingsLink>http://www.greatschools.org/school/rating.page?state=CA&amp;id=8485&amp;s_cid=gsapi</ratingsLink>
19
+ <reviewsLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=8485&amp;s_cid=gsapi</reviewsLink>
20
+ </school>
21
+ <school>
22
+ <gsId>24205</gsId>
23
+ <name>Chinese Christian Schools-Alameda</name>
24
+ <type>private</type>
25
+ <gradeRange>K-8</gradeRange>
26
+ <enrollment>225</enrollment>
27
+ <city>Alameda</city>
28
+ <state>CA</state>
29
+ <address>1801 N Loop Rd, Alameda, CA 94502</address>
30
+ <phone>(510) 522-0200</phone>
31
+ <ncesId>A0500218</ncesId>
32
+ <lat>37.72749</lat>
33
+ <lon>-122.2401</lon>
34
+ <overviewLink>http://www.greatschools.org/cgi-bin/ca/private/24205?s_cid=gsapi</overviewLink>
35
+ <ratingsLink>http://www.greatschools.org/school/rating.page?state=CA&amp;id=24205&amp;s_cid=gsapi</ratingsLink>
36
+ <reviewsLink>http://www.greatschools.org/school/parentReviews.page?state=CA&amp;id=24205&amp;s_cid=gsapi</reviewsLink>
37
+ </school>
38
+ </schools>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <testResults>
3
+ <schoolName>Flagstaff High School</schoolName>
4
+ <rank>
5
+ <name>AZ GS Rating</name>
6
+ <scale>1-10</scale>
7
+ <year>2008</year>
8
+ <description>GreatSchools Ratings for Arizona are based on the 2007-2008 Arizona's Instrument to Measure Standards (AIMS) reading, writing and math results. GreatSchools compared the test results for each grade and subject across all Arizona schools and divided them into 1 through 10 ratings (10 is the best). Please note, private schools are not required to release test results, so ratings are available only for public schools. GreatSchools Ratings cannot be compared across states, because of differences in the states' standardized testing programs. Keep in mind that when comparing schools using GreatSchools Ratings it's important to factor in other information, including the quality of each school's teachers, the school culture, special programs, etc.</description>
9
+ <score>9.0</score>
10
+ </rank>
11
+ <test>
12
+ <name>Arizona's Instrument to Measure Standards</name>
13
+ <id>AZ00137</id>
14
+ <description>In 2007-2008 Arizona's Instrument to Measure Standards (AIMS) was used to test students in reading, writing and mathematics in grades 3 through 8 and 10, and in science in grades 4, 8 and high school. AIMS is a standards-based test, which means that it measures how well students have mastered Arizona's learning standards. Students must pass the grade 10 AIMS in order to graduate. The goal is for all students to meet or exceed state standards on the test.</description>
15
+ <abbreviation>AIMS</abbreviation>
16
+ <scale>% meeting or exceeding standards</scale>
17
+ <levelCode>e,m,h</levelCode>
18
+ <testResult>
19
+ <gradeName>10</gradeName>
20
+ <score>81.0</score>
21
+ <subjectName>Writing</subjectName>
22
+ <testId>AZ00137</testId>
23
+ <year>2008</year>
24
+ </testResult>
25
+ <testResult>
26
+ <gradeName>10</gradeName>
27
+ <score>17.0</score>
28
+ <subjectName>Reading</subjectName>
29
+ <testId>AZ00137</testId>
30
+ <year>2008</year>
31
+ </testResult>
32
+ </test>
33
+ </testResults>
@@ -0,0 +1,28 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe GreatSchools::Census do
4
+ describe '#for_school' do
5
+ it 'should populate a census model from the returned XML' do
6
+ xml = File.read(File.expand_path(
7
+ File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_census_data.xml')
8
+ ))
9
+ FakeWeb.register_uri(:get, 'http://api.greatschools.org/school/census/ND/20?key=0123456789ABCDEF', body: xml)
10
+
11
+ census = GreatSchools::Census.for_school('ND', 20)
12
+ census.school_name.should eql('Simle Middle School')
13
+ census.address.should eql('1215 N 19th St, Bismarck, ND 58501')
14
+ census.latitude.should eql('46.8179')
15
+ census.longitude.should eql('-100.7631')
16
+ census.phone.should eql('(701) 221-3570')
17
+ census.type.should eql('public')
18
+ census.district.should eql('Bismarck 1')
19
+ census.enrollment.should eql('851')
20
+ census.free_and_reduced_price_lunch.should eql('23.3843')
21
+ census.student_teacher_ratio.should eql('14.1')
22
+
23
+ census.ethnicities.each do |ethnicity|
24
+ ethnicity.should be_a(GreatSchools::Ethnicity)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,72 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe GreatSchools::Census do
4
+ describe '#nearby' do
5
+ it 'should populate city models from the returned XML' do
6
+ xml = File.read(File.expand_path(
7
+ File.join(File.dirname(__FILE__), '..', 'fixtures', 'nearby_cities.xml')
8
+ ))
9
+ FakeWeb.register_uri(:get, 'http://api.greatschools.org/cities/nearby/CA/Bakersfield?radius=16&key=0123456789ABCDEF', body: xml)
10
+
11
+ cities = GreatSchools::City.nearby('CA', 'Bakersfield', radius: 16)
12
+
13
+ cities.size.should eql(2)
14
+ cities[0].name.should eql('Lamont')
15
+ cities[1].name.should eql('Arvin')
16
+
17
+ city = cities.first
18
+ city.state.should eql('CA')
19
+ city.name.should eql('Lamont')
20
+ city.rating.should eql('3')
21
+ city.total_schools.should eql('5')
22
+ city.elementary_schools.should eql('3')
23
+ city.middle_schools.should eql('2')
24
+ city.high_schools.should eql('1')
25
+ city.public_schools.should eql('5')
26
+ city.charter_schools.should eql('0')
27
+ city.private_schools.should eql('0')
28
+ end
29
+ end
30
+
31
+ describe '#overview' do
32
+ it 'should populate a city model from the returned XML' do
33
+ xml = File.read(File.expand_path(
34
+ File.join(File.dirname(__FILE__), '..', 'fixtures', 'city_overview.xml')
35
+ ))
36
+ FakeWeb.register_uri(:get, 'http://api.greatschools.org/cities/AK/Anchorage?key=0123456789ABCDEF', body: xml)
37
+
38
+ city = GreatSchools::City.overview('AK', 'Anchorage')
39
+
40
+ city.state.should eql('AK')
41
+ city.name.should eql('Anchorage')
42
+ city.rating.should eql('7')
43
+ city.total_schools.should eql('103')
44
+ city.elementary_schools.should eql('76')
45
+ city.middle_schools.should eql('41')
46
+ city.high_schools.should eql('33')
47
+ city.public_schools.should eql('74')
48
+ city.charter_schools.should eql('6')
49
+ city.private_schools.should eql('23')
50
+ end
51
+ end
52
+
53
+ describe '.districts' do
54
+ it 'should make a GreatSchools::District#browse call using the state/city attributes' do
55
+ city = GreatSchools::City.new(state: 'IL', city: 'Chicago')
56
+
57
+ GreatSchools::District.should_receive(:browse).with('IL', 'Chicago')
58
+
59
+ city.districts
60
+ end
61
+ end
62
+
63
+ describe '.reviews' do
64
+ it 'should make a GreatSchools::Review#for_city call using the state/city attributes' do
65
+ city = GreatSchools::City.new(state: 'IL', name: 'Chicago')
66
+
67
+ GreatSchools::Review.should_receive(:for_city).with('IL', 'Chicago', {})
68
+
69
+ city.reviews
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe GreatSchools::District do
4
+ describe '#browse' do
5
+ it 'should populate district models from the returned XML' do
6
+ xml = File.read(File.expand_path(
7
+ File.join(File.dirname(__FILE__), '..', 'fixtures', 'browse_districts.xml')
8
+ ))
9
+ FakeWeb.register_uri(:get, 'http://api.greatschools.org/districts/CA/San-Francisco?key=0123456789ABCDEF', body: xml)
10
+
11
+ districts = GreatSchools::District.browse('CA', 'San Francisco')
12
+
13
+ districts.size.should eql(2)
14
+ districts[0].name.should eql('San Francisco Unified School District')
15
+ districts[1].name.should eql('San Francisco County Office of Education')
16
+
17
+ district = districts.first
18
+ district.name.should eql('San Francisco Unified School District')
19
+ district.nces_code.should eql('0634410')
20
+ district.district_rating.should eql('6')
21
+ district.address.should eql('555 Franklin St., San Francisco, CA 94102')
22
+ district.phone.should eql('(415) 241-6000')
23
+ district.fax.should eql('(415) 241-6012')
24
+ district.website.should eql('http://www.sfusd.k12.ca.us')
25
+ district.grade_range.should eql('K-12 & ungraded')
26
+ district.total_schools.should eql('121')
27
+ district.elementary_schools.should eql('84')
28
+ district.middle_schools.should eql('36')
29
+ district.high_schools.should eql('34')
30
+ district.public_schools.should eql('113')
31
+ district.charter_schools.should eql('8')
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
+
3
+ describe GreatSchools::Ethnicity do
4
+ it 'should populate an ethnicity model from the returned XML, through a census' do
5
+ xml = File.read(File.expand_path(
6
+ File.join(File.dirname(__FILE__), '..', 'fixtures', 'school_census_data.xml')
7
+ ))
8
+ FakeWeb.register_uri(:get, 'http://api.greatschools.org/school/census/ND/20?key=0123456789ABCDEF', body: xml)
9
+
10
+ census = GreatSchools::Census.for_school('ND', 20)
11
+ ethnicity = census.ethnicities.first
12
+
13
+ ethnicity.name.should eql('White, non-Hispanic')
14
+ ethnicity.value.should eql('91.0693')
15
+ ethnicity.year.should eql('2007')
16
+ end
17
+ end