great_schools 0.2.0 → 0.2.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: 94016dffa6d51793750767c6514957a739134678
4
- data.tar.gz: f3a05dcad61849ba50b046dc3723a81da5576c84
3
+ metadata.gz: 8dacaa7590acb825582391555c7f78611a8ca1fc
4
+ data.tar.gz: 855cd94cb68b95a934a117337e16750e59aef0aa
5
5
  SHA512:
6
- metadata.gz: 9cbd0e320ea4a92d646a5a8c1a8ce3534d657a020b198771493aa95acbe0fffb91389ee21584e091faecd56620438c8352cb5f6d8572c2cd5d8b87696c5e0f2f
7
- data.tar.gz: d3937c82b6c4cc4e309494d149be67816c4e54e27fed2739e0232269de2a510d76399169757ff1a75746379f76e1dc1ad7e337dde3ead0edd64c8a892bf9b9a4
6
+ metadata.gz: eb4d033feabc3e97f12b8689f03ea70a70b4141afe4d2bb4dfbe6b6cd56eb44cbfe29a1cc47c0425dde7751ab8f9e696d0c5f06d4dba47a94a79c2ae50f8e92e
7
+ data.tar.gz: 1cf08131c9d8163d136145a71e964e7b1bbc3b33911d597fea0b274807c7cfadfb1430c757f60cba15ca334a047990e60c943fbb64dce5b290fd3af276061410
@@ -67,6 +67,8 @@ module GreatSchools
67
67
 
68
68
  if response.code.eql?(200)
69
69
  parse(response.values.first) # strip the container element before parsing
70
+ elsif response.body.blank?
71
+ nil # no error to parse, return nothing
70
72
  else
71
73
  raise GreatSchools::Error.new(response)
72
74
  end
@@ -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 = 0 # version when you make backwards-compatible bug fixes
5
+ PATCH = 1 # 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
@@ -39,6 +39,13 @@ describe GreatSchools::School do
39
39
  school.reviews_link.should eql('http://www.greatschools.org/school/parentReviews.page?state=CA&id=13978&s_cid=gsapi')
40
40
  school.school_stats_link.should eql('http://www.greatschools.org/cgi-bin/CA/otherprivate/13978')
41
41
  end
42
+
43
+ it 'should return an empty array if the server response with no data (404)' do
44
+ FakeWeb.register_uri(:get, 'http://api.greatschools.org/schools/AS/Pago-Pago?limit=2&key=0123456789ABCDEF', body: nil, status: ['404', 'Not Found'])
45
+
46
+ schools = GreatSchools::School.browse('AS', 'Pago Pago', limit: 2)
47
+ schools.size.should eql(0)
48
+ end
42
49
  end
43
50
 
44
51
  describe '#nearby' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: great_schools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler