Permalink
Browse files

Adding fallback catcher for v2 errors

  • Loading branch information...
1 parent beff7e4 commit 4855a9b59951fbb49aeafeda40b502ac1b3ea51a @baldrailers baldrailers committed Jul 23, 2012
Showing with 7 additions and 3 deletions.
  1. +1 −1 lib/sqoot.rb
  2. +5 −1 lib/sqoot/response/parse_gzip.rb
  3. +1 −1 spec/sqoot_spec.rb
View
@@ -20,7 +20,7 @@ def configure
end
def load_defaults
- self.api_url ||= "http://api.sqoot.com"
+ self.api_url ||= "https://api.sqoot.com"
self.api_version ||= 2
end
@@ -18,7 +18,11 @@ def parse(body)
gz = Zlib::GzipReader.new(sio)
self.class.mash_class.new(JSON.parse(gz.read()))
rescue
- self.class.mash_class.new JSON.parse body
+ if body.is_a? String
+ self.class.mash_class.new(:error => body)
+ else
+ self.class.mash_class.new JSON.parse body
+ end
end
end
View
@@ -18,7 +18,7 @@
end
it "should use HTTP API endpoint" do
- client.api_url.should == "http://api.sqoot.com"
+ client.api_url.should == "https://api.sqoot.com"
end
end

0 comments on commit 4855a9b

Please sign in to comment.