Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lib/zester/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ def initialize(client)
end

def get_results(endpoint, resource_type, params = {})
begin
Response.new(self.client.perform_get(endpoint, params), resource_type)
rescue Timeout::Error, Exception
Response.new({resource_type => {:message => {:code => "3", :text => "Web services are currently unavailable"}}}, resource_type)
end
Response.new(self.client.perform_get(endpoint, params), resource_type)
end

end
Expand Down
8 changes: 2 additions & 6 deletions spec/zester/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@
VCR.turn_on!
end

it "should rescue a timeout error" do
it "should not rescue a timeout error" do
stub_request(:get, "http://www.zillow.com/webservice/GetRateSummary.htm?zws-id=#{ZWS_ID}").to_timeout
response = resource.get_results('GetRateSummary', :rate_summary)
response.success?.should be_false
response.message.should_not be_nil
response.message.code.should == "3"
response.response_code.should == 3
expect {get_response}.to raise_error(Timeout::Error)
end
end

Expand Down