indeed
Advanced tools
+3
-4
@@ -8,7 +8,7 @@ # Generated by jeweler | ||
| s.name = %q{indeed} | ||
| s.version = "0.1.1" | ||
| s.version = "0.1.2" | ||
| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
| s.authors = ["Bogdan Gusiev"] | ||
| s.date = %q{2011-06-21} | ||
| s.date = %q{2011-09-09} | ||
| s.description = %q{Simple wrapper for JSON api provided by indeed. | ||
@@ -33,3 +33,3 @@ Original documentation at: | ||
| s.require_paths = ["lib"] | ||
| s.rubygems_version = %q{1.3.7} | ||
| s.rubygems_version = %q{1.6.2} | ||
| s.summary = %q{Api wrap from Indeed service http://indeed.com} | ||
@@ -42,3 +42,2 @@ s.test_files = [ | ||
| if s.respond_to? :specification_version then | ||
| current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION | ||
| s.specification_version = 3 | ||
@@ -45,0 +44,0 @@ |
+5
-1
@@ -73,4 +73,8 @@ require 'net/http' | ||
| query = "#{path}?#{params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&')}" | ||
| begin | ||
| data = Yajl::Parser.parse(Net::HTTP.get(domain, query)) | ||
| rescue Yajl::ParseError | ||
| raise IndeedError, 'Did not get a valid JSON response from Indeed' | ||
| end | ||
| data = Yajl::Parser.parse(Net::HTTP.get(domain, query)) | ||
| if error = data["error"] | ||
@@ -77,0 +81,0 @@ raise IndeedError, error |
+16
-0
@@ -61,2 +61,18 @@ require 'spec_helper' | ||
| end | ||
| context "when Indeed returns html instead of json" do | ||
| before(:each) do | ||
| Net::HTTP.stubs(:get).returns(<<-HTML) | ||
| <h1>Internal Error</h1> | ||
| HTML | ||
| end | ||
| it "should raise exception" do | ||
| lambda { | ||
| Indeed.search({}) | ||
| }.should raise_error(IndeedError) | ||
| end | ||
| end | ||
| end |
+1
-1
@@ -1,1 +0,1 @@ | ||
| 0.1.1 | ||
| 0.1.2 |