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
1 change: 0 additions & 1 deletion lib/zester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'zester/client'
require 'zester/resource'
require 'zester/response'
require 'zester/mortgage'
require 'zester/neighborhood'
require 'zester/property'
require 'zester/valuation'
4 changes: 0 additions & 4 deletions lib/zester/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ def property
@property = Zester::Property.new(self)
end

def mortgage
@mortgage = Zester::Mortgage.new(self)
end

def valuation
@valuation = Zester::Valuation.new(self)
end
Expand Down
9 changes: 0 additions & 9 deletions lib/zester/mortgage.rb

This file was deleted.

4 changes: 4 additions & 0 deletions spec/support/webmock_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ def new_zester
def new_timeout_zester
Zester::Client.new(ZWS_ID, 5)
end

def get_response(state = 'CA')
resource.get_results('GetRegionChildren', :regionchildren, state: state)
end
5 changes: 0 additions & 5 deletions spec/zester/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
zester.property.client.should == zester
end

it "should return an instance of Zester::Valuatiion for mortgage" do
zester.mortgage.should be_kind_of(Zester::Mortgage)
zester.mortgage.client.should == zester
end

it "should return an instance of Zester::Valuatiion for neighborhood" do
zester.neighborhood.should be_kind_of(Zester::Neighborhood)
zester.neighborhood.client.should == zester
Expand Down
29 changes: 0 additions & 29 deletions spec/zester/mortgage_spec.rb

This file was deleted.

7 changes: 4 additions & 3 deletions spec/zester/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
context "get_results" do
it "should return a response" do
VCR.use_cassette('resource') do
response = resource.get_results('GetRateSummary', :rate_summary)
response = get_response
response.success?.should be_true
response.should be_instance_of(Zester::Response)
end
end
Expand All @@ -27,8 +28,8 @@
end

it "should 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)
stub_request(:get, "http://www.zillow.com/webservice/GetRegionChildren.htm?state=CA&zws-id=#{ZWS_ID}").to_timeout
response = get_response
response.success?.should be_false
response.message.should_not be_nil
response.message.code.should == "3"
Expand Down
30 changes: 15 additions & 15 deletions spec/zester/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

it "should return a success" do
VCR.use_cassette('response') do
response = resource.get_results('GetRateSummary', :rate_summary)
response = get_response
response.success?.should be_true
response.message.should_not be_nil
response.message.code.should == "0"
Expand All @@ -18,45 +18,45 @@

it "should return a failure" do
VCR.use_cassette('response') do
response = resource.get_results('GetRateSummary', :rate_summary, {'state' => 'XZ'})
response = get_response('XZ')
response.success?.should be_false
response.error_message.should_not be_nil
response.message.code.should == "501"
response.response_code.should == 501
response.message.code.should == "502"
response.response_code.should == 502
end
end

context "respond_to?" do
it "should respond to methods called from body.response" do
VCR.use_cassette('response') do
response = resource.get_results('GetRateSummary', :rate_summary)
response.should respond_to(:today)
response.should respond_to(:last_week)
response = get_response
response.should respond_to(:region)
response.should respond_to(:subregiontype)
end
end

it "should not respond to methods called off body.response" do
VCR.use_cassette('response') do
response = resource.get_results('GetRateSummary', :rate_summary, {'state' => 'XZ'})
response.should_not respond_to(:today)
response.should_not respond_to(:last_week)
response = get_response('XZ')
response.should_not respond_to(:region)
response.should_not respond_to(:subregiontype)
end
end
end

context "method_missing" do
it "should call methods off of the body.response" do
VCR.use_cassette('response') do
response = resource.get_results('GetRateSummary', :rate_summary)
response.today.should == response.body.response.today
response = get_response
response.subregiontype.should == response.body.response.subregiontype
end
end

it "should raise errors when the method does not exist" do
VCR.use_cassette('response') do
response = resource.get_results('GetRateSummary', :rate_summary, {'state' => 'XZ'})
expect {response.today}.to raise_error(NoMethodError)
expect {response.last_week}.to raise_error(NoMethodError)
response = get_response('XZ')
expect {response.region}.to raise_error(NoMethodError)
expect {response.subregiontype}.to raise_error(NoMethodError)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions zester.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency 'httparty', '~> 0.12.0'
s.add_dependency "rash", "~> 0.4.0"
s.add_development_dependency "rake", "~> 0.9.2"
s.add_development_dependency "rspec", "~> 2.10.0"
s.add_development_dependency "webmock", "~> 1.8.6"
s.add_development_dependency "vcr", "~> 2.1.1"
s.add_dependency 'httparty', '~> 0.17'
s.add_dependency "rash", "~> 0.4"
s.add_development_dependency "rake", "~> 12.3"
s.add_development_dependency "rspec", "~> 2.10"
s.add_development_dependency "webmock", "~> 3.5"
s.add_development_dependency "vcr", "~> 4.0"
end