schoolfinder 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/schoolfinder/client.rb
CHANGED
@@ -11,7 +11,7 @@ module Schoolfinder
|
|
11
11
|
self.class.default_params :key => api_key
|
12
12
|
self.class.default_params :sn => 'sf'
|
13
13
|
self.class.default_params :resf => 'json'
|
14
|
-
self.class.default_params :v => '
|
14
|
+
self.class.default_params :v => '5'
|
15
15
|
self.http_timeout = http_timeout
|
16
16
|
end
|
17
17
|
|
@@ -19,6 +19,11 @@ module Schoolfinder
|
|
19
19
|
params = {:f => 'schoolSearch'}
|
20
20
|
make_request(params, optional_params)
|
21
21
|
end
|
22
|
+
|
23
|
+
def assigned_schools(optional_params = {})
|
24
|
+
params = {:f => 'getAssignedSchools'}
|
25
|
+
make_request(params, optional_params)
|
26
|
+
end
|
22
27
|
|
23
28
|
def test_rating(options)
|
24
29
|
params = {:f => 'getTestRating'}
|
data/lib/schoolfinder/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
[{"school":{"schoolid":"85302","schoolname":"Greenville Senior HI High School","zip":"29601","address":"1 Vardry Street","city":"Greenville","districtid":"15031","districtleaid":"4502310","AYPResult":"no","AYPResultYear":"2009","APIGrowth":{"total":""},"APIGrowthYear":"","MetSchoolwideGrowthTarget":null,"distance":0,"enrollment":{"total":1289},"gradelevel":"High","gradesserved":"9-12","latitude":34.840229,"longitude":-82.4064713,"phonenumber":"(864) 355-5500","schooldistrictname":"Greenville School District","schooltype":"Magnet","state":"SC","studentteacherratio":{"total":16},"website":"http:\/\/www.greenville.k12.sc.us\/gvilleh\/","nces_id":"450231000564","url":"http:\/\/www.education.com\/schoolfinder\/us\/south-carolina\/greenville\/greenville-senior-high-academy\/"}},{"school":{"schoolid":"85381","schoolname":"Fuller Normal Advanced Charter School","zip":"29601","address":"Box 102","city":"Greenville","districtid":"15031","districtleaid":"4502310","AYPResult":"yes","AYPResultYear":"2009","APIGrowth":{"total":""},"APIGrowthYear":"","MetSchoolwideGrowthTarget":null,"distance":0,"enrollment":{"total":161},"gradelevel":"Elementary","gradesserved":"K-6","latitude":34.852623,"longitude":-82.3981018,"phonenumber":"(864) 271-3698","schooldistrictname":"Greenville School District","schooltype":"Charter","state":"SC","studentteacherratio":{"total":12},"website":"http:\/\/www.fnatcs.org","nces_id":"450231000962","url":"http:\/\/www.education.com\/schoolfinder\/us\/south-carolina\/greenville\/fuller-normal-advanced-charter-school\/"}},{"school":{"schoolid":"85990","schoolname":"Governor's School - Arts & Humanities","zip":"29601","address":"15 University Street","city":"Greenville","districtid":"15102","districtleaid":null,"AYPResult":null,"AYPResultYear":null,"APIGrowth":{"total":""},"APIGrowthYear":"","MetSchoolwideGrowthTarget":null,"distance":0,"enrollment":{"total":0},"gradelevel":"High","gradesserved":"9-12","latitude":34.8540382,"longitude":-82.3976288,"phonenumber":"(864) 282-3777","schooldistrictname":"Governor's Schools School District","schooltype":"Public","state":"SC","studentteacherratio":{"total":0},"website":"http:\/\/www.scgsah.state.sc.us","nces_id":null,"url":"http:\/\/www.education.com\/schoolfinder\/us\/south-carolina\/greenville\/governors-school--arts-and-humanities\/"}},{"school":{"schoolid":"105063","schoolname":"St Marys School","zip":"29601","address":"101 Hampton Ave","city":"Greenville","districtid":"16587","districtleaid":null,"AYPResult":null,"AYPResultYear":null,"APIGrowth":{"total":""},"APIGrowthYear":"","MetSchoolwideGrowthTarget":null,"distance":0,"enrollment":{"total":293},"gradelevel":"Elementary,Middle","gradesserved":"PK, K-8","latitude":34.8535957,"longitude":-82.4024353,"phonenumber":"(864) 271-3870","schooldistrictname":"SC Private Schools","schooltype":"Private","state":"SC","studentteacherratio":{"total":18},"website":"www.stmarysgvl.org\/theschool","nces_id":"01262779","url":"http:\/\/www.education.com\/schoolfinder\/us\/south-carolina\/greenville\/st-marys-school\/"}},{"school":{"schoolid":"105113","schoolname":"Haynsworth School","zip":"29601","address":"228 E Park Ave","city":"Greenville","districtid":"16587","districtleaid":null,"AYPResult":null,"AYPResultYear":null,"APIGrowth":{"total":""},"APIGrowthYear":"","MetSchoolwideGrowthTarget":null,"distance":0,"enrollment":{"total":40},"gradelevel":"Elementary","gradesserved":"PK, K-2","latitude":34.8574028,"longitude":-82.3923035,"phonenumber":"(864) 235-3010","schooldistrictname":"SC Private Schools","schooltype":"Private","state":"SC","studentteacherratio":{"total":3},"website":null,"nces_id":"01264018","url":"http:\/\/www.education.com\/schoolfinder\/us\/south-carolina\/greenville\/haynsworth-school\/"}},{"school":{"schoolid":"125062","schoolname":"First Presbyterian Academy","zip":"29601","address":"200 W Washington St","city":"Greenville","districtid":"16587","districtleaid":null,"AYPResult":null,"AYPResultYear":null,"APIGrowth":{"total":""},"APIGrowthYear":"","MetSchoolwideGrowthTarget":null,"distance":0,"enrollment":{"total":209},"gradelevel":"Elementary","gradesserved":"PK, K-1","latitude":34.851284,"longitude":-82.4006958,"phonenumber":"(864) 235-0122","schooldistrictname":"SC Private Schools","schooltype":"Private","state":"SC","studentteacherratio":{"total":5},"website":null,"nces_id":"K9305758","url":"http:\/\/www.education.com\/schoolfinder\/us\/south-carolina\/greenville\/first-presbyterian-church-kind\/"}}]
|
@@ -11,7 +11,7 @@ describe "Schoolfinder::Client" do
|
|
11
11
|
@schoolfinder.class.default_params[:key].should == SCHOOLFINDER_API_KEY
|
12
12
|
@schoolfinder.class.default_params[:sn].should == 'sf'
|
13
13
|
@schoolfinder.class.default_params[:resf].should == 'json'
|
14
|
-
@schoolfinder.class.default_params[:v].should == '
|
14
|
+
@schoolfinder.class.default_params[:v].should == '5'
|
15
15
|
@schoolfinder.http_timeout.should be_nil
|
16
16
|
end
|
17
17
|
end
|
@@ -23,7 +23,7 @@ describe "Schoolfinder::Client" do
|
|
23
23
|
@schoolfinder.class.default_params[:key].should == SCHOOLFINDER_API_KEY
|
24
24
|
@schoolfinder.class.default_params[:sn].should == 'sf'
|
25
25
|
@schoolfinder.class.default_params[:resf].should == 'json'
|
26
|
-
@schoolfinder.class.default_params[:v].should == '
|
26
|
+
@schoolfinder.class.default_params[:v].should == '5'
|
27
27
|
@schoolfinder.http_timeout.should == 5
|
28
28
|
end
|
29
29
|
end
|
@@ -42,6 +42,21 @@ describe "Schoolfinder::Client" do
|
|
42
42
|
@response.body.first.should be_kind_of(Hashie::Rash)
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
context "assigned_schools" do
|
47
|
+
before do
|
48
|
+
mock_get({"f" => "getAssignedSchools", "latitude" => "42.34", "longitude" => "-71.05"}, 'assigned_schools.json')
|
49
|
+
end
|
50
|
+
|
51
|
+
it { lambda {@schoolfinder.assigned_schools(:latitude => "42.34", :longitude => "-71.05")}.should_not raise_exception }
|
52
|
+
|
53
|
+
it "should return a response" do
|
54
|
+
@response = @schoolfinder.assigned_schools(:latitude => "42.34", :longitude => "-71.05")
|
55
|
+
@response.should_not be_nil
|
56
|
+
@response.body.should be_kind_of(Array)
|
57
|
+
@response.body.first.should be_kind_of(Hashie::Rash)
|
58
|
+
end
|
59
|
+
end
|
45
60
|
|
46
61
|
context "test_rating" do
|
47
62
|
before do
|
data/spec/spec_helper.rb
CHANGED
@@ -15,7 +15,7 @@ def new_timeout_schoolfinder
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def default_params
|
18
|
-
{"v" => "
|
18
|
+
{"v" => "5", "key" => SCHOOLFINDER_API_KEY, "resf" => "json", "sn" => "sf"}
|
19
19
|
end
|
20
20
|
|
21
21
|
def mock_get(params, response_fixture)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schoolfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Cocca
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/schoolfinder/response.rb
|
135
135
|
- lib/schoolfinder/version.rb
|
136
136
|
- schoolfinder.gemspec
|
137
|
+
- spec/responses/assigned_schools.json
|
137
138
|
- spec/responses/branding_data.json
|
138
139
|
- spec/responses/district_search.json
|
139
140
|
- spec/responses/failure.json
|
@@ -184,6 +185,7 @@ signing_key:
|
|
184
185
|
specification_version: 3
|
185
186
|
summary: ruby api wrapper for education.com schoolfinder
|
186
187
|
test_files:
|
188
|
+
- spec/responses/assigned_schools.json
|
187
189
|
- spec/responses/branding_data.json
|
188
190
|
- spec/responses/district_search.json
|
189
191
|
- spec/responses/failure.json
|