rubillow 0.0.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.
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.yardopts +4 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +43 -0
- data/LICENSE +21 -0
- data/README.md +64 -0
- data/Rakefile +38 -0
- data/lib/rubillow.rb +29 -0
- data/lib/rubillow/configuration.rb +31 -0
- data/lib/rubillow/home_valuation.rb +141 -0
- data/lib/rubillow/models.rb +83 -0
- data/lib/rubillow/models/addressable.rb +38 -0
- data/lib/rubillow/models/chart.rb +34 -0
- data/lib/rubillow/models/comps.rb +35 -0
- data/lib/rubillow/models/deep_comps.rb +35 -0
- data/lib/rubillow/models/deep_search_result.rb +44 -0
- data/lib/rubillow/models/demographic_value.rb +28 -0
- data/lib/rubillow/models/demographics.rb +149 -0
- data/lib/rubillow/models/images.rb +24 -0
- data/lib/rubillow/models/linkable.rb +39 -0
- data/lib/rubillow/models/monthly_payments.rb +64 -0
- data/lib/rubillow/models/posting.rb +37 -0
- data/lib/rubillow/models/postings.rb +64 -0
- data/lib/rubillow/models/property_basics.rb +36 -0
- data/lib/rubillow/models/property_chart.rb +26 -0
- data/lib/rubillow/models/rate_summary.rb +38 -0
- data/lib/rubillow/models/region.rb +44 -0
- data/lib/rubillow/models/region_chart.rb +30 -0
- data/lib/rubillow/models/region_children.rb +30 -0
- data/lib/rubillow/models/search_result.rb +19 -0
- data/lib/rubillow/models/updated_property_details.rb +87 -0
- data/lib/rubillow/models/zestimateable.rb +77 -0
- data/lib/rubillow/models/zpidable.rb +25 -0
- data/lib/rubillow/mortgage.rb +75 -0
- data/lib/rubillow/neighborhood.rb +129 -0
- data/lib/rubillow/postings.rb +46 -0
- data/lib/rubillow/property_details.rb +107 -0
- data/lib/rubillow/request.rb +67 -0
- data/lib/rubillow/version.rb +4 -0
- data/rubillow.gemspec +31 -0
- data/spec/rubillow/configuration_spec.rb +10 -0
- data/spec/rubillow/home_valuation_spec.rb +91 -0
- data/spec/rubillow/models/comps_spec.rb +71 -0
- data/spec/rubillow/models/deep_comps_spec.rb +93 -0
- data/spec/rubillow/models/deep_search_results_spec.rb +47 -0
- data/spec/rubillow/models/demographics_spec.rb +60 -0
- data/spec/rubillow/models/monthly_payments_spec.rb +20 -0
- data/spec/rubillow/models/posting_spec.rb +28 -0
- data/spec/rubillow/models/postings_spec.rb +15 -0
- data/spec/rubillow/models/property_chart_spec.rb +18 -0
- data/spec/rubillow/models/rate_summary_spec.rb +14 -0
- data/spec/rubillow/models/region_chart_spec.rb +19 -0
- data/spec/rubillow/models/region_children_spec.rb +11 -0
- data/spec/rubillow/models/search_result_spec.rb +68 -0
- data/spec/rubillow/models/updated_property_details_spec.rb +57 -0
- data/spec/rubillow/models_spec.rb +46 -0
- data/spec/rubillow/mortgage_spec.rb +37 -0
- data/spec/rubillow/neighborhood_spec.rb +55 -0
- data/spec/rubillow/postings_spec.rb +19 -0
- data/spec/rubillow/property_details_spec.rb +67 -0
- data/spec/rubillow/request_spec.rb +65 -0
- data/spec/rubillow/rubillow_spec.rb +13 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/have_configuration_matcher.rb +23 -0
- data/spec/xml/general_failure.xml +12 -0
- data/spec/xml/get_chart.xml +18 -0
- data/spec/xml/get_comps.xml +252 -0
- data/spec/xml/get_deep_comps.xml +307 -0
- data/spec/xml/get_deep_search_results.xml +66 -0
- data/spec/xml/get_demographics.xml +791 -0
- data/spec/xml/get_monthly_payments.xml +33 -0
- data/spec/xml/get_rate_summary.xml +21 -0
- data/spec/xml/get_region_chart.xml +25 -0
- data/spec/xml/get_region_children.xml +870 -0
- data/spec/xml/get_region_postings.xml +2660 -0
- data/spec/xml/get_search_results.xml +55 -0
- data/spec/xml/get_updated_property_details.xml +74 -0
- data/spec/xml/get_zestimate.xml +56 -0
- data/spec/xml/near_limit.xml +13 -0
- metadata +324 -0
data/rubillow.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rubillow/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rubillow"
|
7
|
+
s.version = Rubillow::VERSION
|
8
|
+
s.authors = ["Matthew Vince"]
|
9
|
+
s.email = ["rubillow@matthewvince.com"]
|
10
|
+
s.homepage = "https://github.com/synewaves/rubillow"
|
11
|
+
s.summary = "Ruby library to access the Zillow API"
|
12
|
+
s.description = "Ruby library to access the Zillow API"
|
13
|
+
|
14
|
+
s.rubyforge_project = "rubillow"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "rspec", "~> 2.6"
|
22
|
+
s.add_development_dependency "mocha", "~> 0.9.8"
|
23
|
+
s.add_development_dependency "bourne", "~> 1.0"
|
24
|
+
s.add_development_dependency "yard", ">= 0.6.8"
|
25
|
+
s.add_development_dependency "bluecloth", ">= 2.1.0"
|
26
|
+
s.add_development_dependency "rcov", "~> 0.9.10"
|
27
|
+
|
28
|
+
s.add_runtime_dependency "nokogiri", "~> 1.5.0"
|
29
|
+
s.add_runtime_dependency "activesupport", "~> 3.0.10"
|
30
|
+
s.add_runtime_dependency "i18n", "~> 0.6.0"
|
31
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Configuration do
|
4
|
+
it { should have_configuration_option(:host).default("www.zillow.com") }
|
5
|
+
it { should have_configuration_option(:port).default(80) }
|
6
|
+
it { should have_configuration_option(:path).default("webservice/") }
|
7
|
+
it { should have_configuration_option(:zwsid).default(nil) }
|
8
|
+
it { should have_configuration_option(:http_open_timeout).default(2) }
|
9
|
+
it { should have_configuration_option(:http_read_timeout).default(2) }
|
10
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::HomeValuation, ".search_results" do
|
4
|
+
let(:request) { stub("Request", :get => response) }
|
5
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
6
|
+
|
7
|
+
it "requires the address option" do
|
8
|
+
lambda {
|
9
|
+
Rubillow::HomeValuation.search_results({ :citystatezip => 'Seattle, WA' })
|
10
|
+
}.should raise_error(ArgumentError, "The address option is required")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "requires the citystatezip option" do
|
14
|
+
lambda {
|
15
|
+
Rubillow::HomeValuation.search_results({ :address => '2114 Bigelow Ave' })
|
16
|
+
}.should raise_error(ArgumentError, "The citystatezip option is required")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "fetches the XML" do
|
20
|
+
Rubillow::Request.stubs(:request).returns(request)
|
21
|
+
|
22
|
+
response = Rubillow::HomeValuation.search_results({ :address => '2114 Bigelow Ave', :citystatezip => 'Seattle, WA' })
|
23
|
+
response.should be_an_instance_of(Rubillow::Models::SearchResult)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe Rubillow::HomeValuation, ".zestimate" do
|
28
|
+
let(:request) { stub("Request", :get => response) }
|
29
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
30
|
+
|
31
|
+
it "requires the zpid option" do
|
32
|
+
lambda {
|
33
|
+
Rubillow::HomeValuation.zestimate()
|
34
|
+
}.should raise_error(ArgumentError, "The zpid option is required")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "fetches the XML" do
|
38
|
+
Rubillow::Request.stubs(:request).returns(request)
|
39
|
+
|
40
|
+
response = Rubillow::HomeValuation.zestimate({ :zpid => '48749425' })
|
41
|
+
response.should be_an_instance_of(Rubillow::Models::SearchResult)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe Rubillow::HomeValuation, ".chart" do
|
46
|
+
let(:request) { stub("Request", :get => response) }
|
47
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
48
|
+
|
49
|
+
it "requires the zpid option" do
|
50
|
+
lambda {
|
51
|
+
Rubillow::HomeValuation.chart()
|
52
|
+
}.should raise_error(ArgumentError, "The zpid option is required")
|
53
|
+
end
|
54
|
+
|
55
|
+
it "requires the unit_type option" do
|
56
|
+
lambda {
|
57
|
+
Rubillow::HomeValuation.chart({ :zpid => '48749425' })
|
58
|
+
}.should raise_error(ArgumentError, "The unit_type option is required")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "fetches the XML" do
|
62
|
+
Rubillow::Request.stubs(:request).returns(request)
|
63
|
+
|
64
|
+
response = Rubillow::HomeValuation.chart({ :zpid => '48749425', :unit_type => "percent" })
|
65
|
+
response.should be_an_instance_of(Rubillow::Models::PropertyChart)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe Rubillow::HomeValuation, ".comps" do
|
70
|
+
let(:request) { stub("Request", :get => response) }
|
71
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
72
|
+
|
73
|
+
it "requires the zpid option" do
|
74
|
+
lambda {
|
75
|
+
Rubillow::HomeValuation.comps()
|
76
|
+
}.should raise_error(ArgumentError, "The zpid option is required")
|
77
|
+
end
|
78
|
+
|
79
|
+
it "requires the count option" do
|
80
|
+
lambda {
|
81
|
+
Rubillow::HomeValuation.comps({ :zpid => '48749425' })
|
82
|
+
}.should raise_error(ArgumentError, "The count option is required")
|
83
|
+
end
|
84
|
+
|
85
|
+
it "fetches the XML" do
|
86
|
+
Rubillow::Request.stubs(:request).returns(request)
|
87
|
+
|
88
|
+
response = Rubillow::HomeValuation.comps({ :zpid => '48749425', :count => 5 })
|
89
|
+
response.should be_an_instance_of(Rubillow::Models::Comps)
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::Comps do
|
4
|
+
it "populates the results" do
|
5
|
+
data = Rubillow::Models::Comps.new(get_xml('get_comps.xml'))
|
6
|
+
|
7
|
+
data.principal.should be_a(Rubillow::Models::SearchResult)
|
8
|
+
data.comparables.count.should == 5
|
9
|
+
|
10
|
+
principal = data.principal
|
11
|
+
|
12
|
+
principal.zpid.should == '48749425'
|
13
|
+
principal.links.count.should == 5
|
14
|
+
principal.links[:homedetails].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/"
|
15
|
+
principal.links[:graphsanddata].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data"
|
16
|
+
principal.links[:mapthishome].should == "http://www.zillow.com/homes/48749425_zpid/"
|
17
|
+
principal.links[:myestimator].should == "http://www.zillow.com/myestimator/Edit.htm?zprop=48749425"
|
18
|
+
principal.links[:comparables].should == "http://www.zillow.com/homes/comps/48749425_zpid/"
|
19
|
+
principal.address[:street].should == "2114 Bigelow Ave N"
|
20
|
+
principal.address[:city].should == "Seattle"
|
21
|
+
principal.address[:state].should == "WA"
|
22
|
+
principal.address[:zipcode].should == "98109"
|
23
|
+
principal.address[:latitude].should == "47.637933"
|
24
|
+
principal.address[:longitude].should == "-122.347938"
|
25
|
+
principal.price.should == "1032000"
|
26
|
+
principal.percentile.should == "95"
|
27
|
+
principal.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
28
|
+
principal.valuation_range[:low].should == "866880"
|
29
|
+
principal.valuation_range[:high].should == "1259040"
|
30
|
+
principal.change.should == "5900"
|
31
|
+
principal.change_duration.should == "30"
|
32
|
+
principal.local_real_estate.count.should == 3
|
33
|
+
principal.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/East-Queen-Anne/r_271856/"
|
34
|
+
principal.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/East-Queen-Anne-Seattle-WA/"
|
35
|
+
principal.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/East-Queen-Anne-Seattle-WA/"
|
36
|
+
principal.region.should == "East Queen Anne"
|
37
|
+
principal.region_type.should == "neighborhood"
|
38
|
+
principal.region_id.should == "271856"
|
39
|
+
|
40
|
+
comp = data.comparables['0.0813344']
|
41
|
+
comp.should be_a(Rubillow::Models::SearchResult)
|
42
|
+
|
43
|
+
comp.zpid.should == '48768095'
|
44
|
+
comp.links.count.should == 5
|
45
|
+
comp.links[:homedetails].should == "http://www.zillow.com/homedetails/2538-Mayfair-Ave-N-Seattle-WA-98109/48768095_zpid/"
|
46
|
+
comp.links[:graphsanddata].should == "http://www.zillow.com/homedetails/2538-Mayfair-Ave-N-Seattle-WA-98109/48768095_zpid/#charts-and-data"
|
47
|
+
comp.links[:mapthishome].should == "http://www.zillow.com/homes/48768095_zpid/"
|
48
|
+
comp.links[:myestimator].should == "http://www.zillow.com/myestimator/Edit.htm?zprop=48768095"
|
49
|
+
comp.links[:comparables].should == "http://www.zillow.com/homes/comps/48768095_zpid/"
|
50
|
+
comp.address[:street].should == "2538 Mayfair Ave N"
|
51
|
+
comp.address[:city].should == "Seattle"
|
52
|
+
comp.address[:state].should == "WA"
|
53
|
+
comp.address[:zipcode].should == "98109"
|
54
|
+
comp.address[:latitude].should == "47.642566"
|
55
|
+
comp.address[:longitude].should == "-122.352512"
|
56
|
+
comp.price.should == "584400"
|
57
|
+
comp.percentile.should == "75"
|
58
|
+
comp.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
59
|
+
comp.valuation_range[:low].should == "449988"
|
60
|
+
comp.valuation_range[:high].should == "625308"
|
61
|
+
comp.change.should == "-100"
|
62
|
+
comp.change_duration.should == "30"
|
63
|
+
comp.local_real_estate.count.should == 3
|
64
|
+
comp.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/North-Queen-Anne/r_271942/"
|
65
|
+
comp.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/North-Queen-Anne-Seattle-WA/"
|
66
|
+
comp.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/North-Queen-Anne-Seattle-WA/"
|
67
|
+
comp.region.should == "North Queen Anne"
|
68
|
+
comp.region_type.should == "neighborhood"
|
69
|
+
comp.region_id.should == "271942"
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::DeepComps do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::DeepComps.new(get_xml('get_deep_comps.xml'))
|
6
|
+
|
7
|
+
data.principal.should be_a(Rubillow::Models::DeepSearchResult)
|
8
|
+
data.comparables.count.should == 5
|
9
|
+
|
10
|
+
principal = data.principal
|
11
|
+
principal.zpid.should == '48749425'
|
12
|
+
principal.links.count.should == 5
|
13
|
+
principal.links[:homedetails].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/"
|
14
|
+
principal.links[:graphsanddata].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data"
|
15
|
+
principal.links[:mapthishome].should == "http://www.zillow.com/homes/48749425_zpid/"
|
16
|
+
principal.links[:myestimator].should == "http://www.zillow.com/myestimator/Edit.htm?zprop=48749425"
|
17
|
+
principal.links[:comparables].should == "http://www.zillow.com/homes/comps/48749425_zpid/"
|
18
|
+
principal.address[:street].should == "2114 Bigelow Ave N"
|
19
|
+
principal.address[:city].should == "Seattle"
|
20
|
+
principal.address[:state].should == "WA"
|
21
|
+
principal.address[:zipcode].should == "98109"
|
22
|
+
principal.address[:latitude].should == "47.637933"
|
23
|
+
principal.address[:longitude].should == "-122.347938"
|
24
|
+
principal.price.should == "1032000"
|
25
|
+
principal.percentile.should == "95"
|
26
|
+
principal.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
27
|
+
principal.valuation_range[:low].should == "866880"
|
28
|
+
principal.valuation_range[:high].should == "1259040"
|
29
|
+
principal.change.should == "5900"
|
30
|
+
principal.change_duration.should == "30"
|
31
|
+
principal.local_real_estate.count.should == 3
|
32
|
+
principal.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/East-Queen-Anne/r_271856/"
|
33
|
+
principal.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/East-Queen-Anne-Seattle-WA/"
|
34
|
+
principal.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/East-Queen-Anne-Seattle-WA/"
|
35
|
+
principal.region.should == "East Queen Anne"
|
36
|
+
principal.region_type.should == "neighborhood"
|
37
|
+
principal.region_id.should == "271856"
|
38
|
+
principal.fips_county.should == ""
|
39
|
+
principal.tax_assessment_year.should == "2010"
|
40
|
+
principal.tax_assessment.should == "872000.0"
|
41
|
+
principal.year_built.should == "1924"
|
42
|
+
principal.lot_size_square_feet.should == "4680"
|
43
|
+
principal.finished_square_feet.should == "3470"
|
44
|
+
principal.bathrooms.should == "3.0"
|
45
|
+
principal.bedrooms.should == "4"
|
46
|
+
principal.total_rooms.should == ""
|
47
|
+
principal.last_sold_date.strftime("%m/%d/%Y").should == "11/26/2008"
|
48
|
+
principal.last_sold_price.should == "1025000"
|
49
|
+
principal.use_code.should == ""
|
50
|
+
|
51
|
+
comp = data.comparables["0.0813344"]
|
52
|
+
comp.should be_a(Rubillow::Models::DeepSearchResult)
|
53
|
+
comp.zpid.should == '48768095'
|
54
|
+
comp.links.count.should == 5
|
55
|
+
comp.links[:homedetails].should == "http://www.zillow.com/homedetails/2538-Mayfair-Ave-N-Seattle-WA-98109/48768095_zpid/"
|
56
|
+
comp.links[:graphsanddata].should == "http://www.zillow.com/homedetails/2538-Mayfair-Ave-N-Seattle-WA-98109/48768095_zpid/#charts-and-data"
|
57
|
+
comp.links[:mapthishome].should == "http://www.zillow.com/homes/48768095_zpid/"
|
58
|
+
comp.links[:myestimator].should == "http://www.zillow.com/myestimator/Edit.htm?zprop=48768095"
|
59
|
+
comp.links[:comparables].should == "http://www.zillow.com/homes/comps/48768095_zpid/"
|
60
|
+
comp.address[:street].should == "2538 Mayfair Ave N"
|
61
|
+
comp.address[:city].should == "Seattle"
|
62
|
+
comp.address[:state].should == "WA"
|
63
|
+
comp.address[:zipcode].should == "98109"
|
64
|
+
comp.address[:latitude].should == "47.642566"
|
65
|
+
comp.address[:longitude].should == "-122.352512"
|
66
|
+
comp.price.should == "584400"
|
67
|
+
comp.percentile.should == "75"
|
68
|
+
comp.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
69
|
+
comp.valuation_range[:low].should == "449988"
|
70
|
+
comp.valuation_range[:high].should == "625308"
|
71
|
+
comp.change.should == "-100"
|
72
|
+
comp.change_duration.should == "30"
|
73
|
+
comp.local_real_estate.count.should == 3
|
74
|
+
comp.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/North-Queen-Anne/r_271942/"
|
75
|
+
comp.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/North-Queen-Anne-Seattle-WA/"
|
76
|
+
comp.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/North-Queen-Anne-Seattle-WA/"
|
77
|
+
comp.region.should == "North Queen Anne"
|
78
|
+
comp.region_type.should == "neighborhood"
|
79
|
+
comp.region_id.should == "271942"
|
80
|
+
comp.fips_county.should == ""
|
81
|
+
comp.tax_assessment_year.should == "2010"
|
82
|
+
comp.tax_assessment.should == "431000.0"
|
83
|
+
comp.year_built.should == "1955"
|
84
|
+
comp.lot_size_square_feet.should == "16514"
|
85
|
+
comp.finished_square_feet.should == "2600"
|
86
|
+
comp.bathrooms.should == "2.75"
|
87
|
+
comp.bedrooms.should == "4"
|
88
|
+
comp.total_rooms.should == "8"
|
89
|
+
comp.last_sold_date.strftime("%m/%d/%Y").should == "07/27/2011"
|
90
|
+
comp.last_sold_price.should == "545000"
|
91
|
+
comp.use_code.should == ""
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::DeepSearchResult do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::DeepSearchResult.new(get_xml('get_deep_search_results.xml'))
|
6
|
+
|
7
|
+
data.zpid.should == '48749425'
|
8
|
+
data.links.count.should == 5
|
9
|
+
data.links[:homedetails].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/"
|
10
|
+
data.links[:graphsanddata].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data"
|
11
|
+
data.links[:mapthishome].should == "http://www.zillow.com/homes/48749425_zpid/"
|
12
|
+
data.links[:myestimator].should == "http://www.zillow.com/myestimator/Edit.htm?zprop=48749425"
|
13
|
+
data.links[:comparables].should == "http://www.zillow.com/homes/comps/48749425_zpid/"
|
14
|
+
data.address[:street].should == "2114 Bigelow Ave N"
|
15
|
+
data.address[:city].should == "Seattle"
|
16
|
+
data.address[:state].should == "WA"
|
17
|
+
data.address[:zipcode].should == "98109"
|
18
|
+
data.address[:latitude].should == "47.637933"
|
19
|
+
data.address[:longitude].should == "-122.347938"
|
20
|
+
data.price.should == "1032000"
|
21
|
+
data.percentile.should == "0"
|
22
|
+
data.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
23
|
+
data.valuation_range[:low].should == "866880"
|
24
|
+
data.valuation_range[:high].should == "1259040"
|
25
|
+
data.change.should == "5900"
|
26
|
+
data.change_duration.should == "30"
|
27
|
+
data.local_real_estate.count.should == 3
|
28
|
+
data.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/East-Queen-Anne/r_271856/"
|
29
|
+
data.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/East-Queen-Anne-Seattle-WA/"
|
30
|
+
data.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/East-Queen-Anne-Seattle-WA/"
|
31
|
+
data.region.should == "East Queen Anne"
|
32
|
+
data.region_type.should == "neighborhood"
|
33
|
+
data.region_id.should == "271856"
|
34
|
+
data.fips_county.should == "53033"
|
35
|
+
data.tax_assessment_year.should == "2010"
|
36
|
+
data.tax_assessment.should == "872000.0"
|
37
|
+
data.year_built.should == "1924"
|
38
|
+
data.lot_size_square_feet.should == "4680"
|
39
|
+
data.finished_square_feet.should == "3470"
|
40
|
+
data.bathrooms.should == "3.0"
|
41
|
+
data.bedrooms.should == "4"
|
42
|
+
data.total_rooms.should == ""
|
43
|
+
data.last_sold_date.strftime("%m/%d/%Y").should == "11/26/2008"
|
44
|
+
data.last_sold_price.should == "1025000"
|
45
|
+
data.use_code.should == "SingleFamily"
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::Demographics do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::Demographics.new(get_xml('get_demographics.xml'))
|
6
|
+
|
7
|
+
data.region.id.should == "250017"
|
8
|
+
data.region.state.should == "Washington"
|
9
|
+
data.region.neighborhood.should == "Ballard"
|
10
|
+
data.region.latitude.should == "47.668329"
|
11
|
+
data.region.longitude.should == "-122.384536"
|
12
|
+
data.region.zmmrateurl.should == "http://www.zillow.com/mortgage-rates/wa/seattle/"
|
13
|
+
|
14
|
+
data.links.count.should == 8
|
15
|
+
|
16
|
+
data.charts.count.should == 6
|
17
|
+
data.charts['Median Condo Value'].should == "http://www.zillow.com/app?chartType=affordability_avgCondoValue&graphType=barChart®ionId=250017®ionType=8&service=chart"
|
18
|
+
|
19
|
+
data.affordability_data.count.should == 20
|
20
|
+
data.affordability_data['Zillow Home Value Index'][:neighborhood].value.should == "305200"
|
21
|
+
data.affordability_data['Zillow Home Value Index'][:neighborhood].type.should == "USD"
|
22
|
+
data.affordability_data['Median Single Family Home Value'][:city].value.should == "377000"
|
23
|
+
data.affordability_data['Median Condo Value'][:nation].value.should == "155800"
|
24
|
+
|
25
|
+
data.census_data.count.should == 7
|
26
|
+
data.census_data['HomeSize']['<1000sqft'].value.should == "0.3922527265889"
|
27
|
+
data.census_data['HomeSize']['<1000sqft'].type.should == "percent"
|
28
|
+
data.census_data['HomeSize']['1800-2400sqft'].value.should == "0.0699511094396"
|
29
|
+
data.census_data['HomeType']['Other'].value.should == "1.9343463444890998"
|
30
|
+
data.census_data['HomeType']['SingleFamily'].value.should == "0.1712158808933"
|
31
|
+
data.census_data['Occupancy']['Rent'].value.should == "0.64971382"
|
32
|
+
data.census_data['Occupancy']['Rent'].type.should == "percent"
|
33
|
+
data.census_data['AgeDecade']['40s'].value.should == "0.159760457231474"
|
34
|
+
data.census_data['AgeDecade']['40s'].type.should == "percent"
|
35
|
+
data.census_data['Household']['NoKids'].value.should == "0.850066140827795"
|
36
|
+
data.census_data['Household']['NoKids'].type.should == "percent"
|
37
|
+
|
38
|
+
data.metrics.count.should == 3
|
39
|
+
data.metrics['BuiltYear']['<1900'].value.should == "0.0419354838709"
|
40
|
+
data.metrics['BuiltYear']['<1900'].to_s.should == "0.0419354838709"
|
41
|
+
data.metrics['BuiltYear']['<1900'].type.should == "percent"
|
42
|
+
data.metrics['BuiltYear']['1940-1959'].value.should == "0.0537634408602"
|
43
|
+
data.metrics['BuiltYear']['1940-1959'].type.should == "percent"
|
44
|
+
data.metrics['People Data']['Median Household Income'][:neighborhood].value.should == "41202.9453206937"
|
45
|
+
data.metrics['People Data']['Single Females'][:city].value.should == "0.187486853578992"
|
46
|
+
data.metrics['People Data']['Average Commute Time (Minutes)'][:nation].value.should == "26.375545725891282"
|
47
|
+
|
48
|
+
data.segmentation.count.should == 3
|
49
|
+
data.segmentation["Makin' It Singles"][:name].should == "Upper-scale urban singles."
|
50
|
+
data.segmentation["Makin' It Singles"][:description].should == "Pre-middle-age to middle-age singles with upper-scale incomes. May or may not own their own home. Most have college educations and are employed in mid-management professions."
|
51
|
+
data.segmentation['Aspiring Urbanites'][:name].should == "Urban singles with moderate income."
|
52
|
+
data.segmentation['Aspiring Urbanites'][:description].should == "Low- to middle-income singles over a wide age range. Some have a college education. They work in a variety of occupations, including some management-level positions."
|
53
|
+
|
54
|
+
data.characteristics.count.should == 4
|
55
|
+
data.characteristics['Education'].should include("Bachelor's degrees")
|
56
|
+
data.characteristics['Employment'].should include("Work in office and administrative support occupations")
|
57
|
+
data.characteristics['People & Culture'].should include("Divorced females")
|
58
|
+
data.characteristics['Transportation'].should include("Get to work by bus")
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::MonthlyPayments do
|
4
|
+
it "populates the results" do
|
5
|
+
data = Rubillow::Models::MonthlyPayments.new(get_xml('get_monthly_payments.xml'))
|
6
|
+
|
7
|
+
data.thirty_year_fixed[:rate].should == "4.01"
|
8
|
+
data.thirty_year_fixed[:principal_and_interest].should == "1219"
|
9
|
+
data.thirty_year_fixed[:mortgage_insurance].should == "93"
|
10
|
+
data.fifteen_year_fixed[:rate].should == "3.27"
|
11
|
+
data.fifteen_year_fixed[:principal_and_interest].should == "1795"
|
12
|
+
data.fifteen_year_fixed[:mortgage_insurance].should == "93"
|
13
|
+
data.five_one_arm[:rate].should == "3.27"
|
14
|
+
data.five_one_arm[:principal_and_interest].should == "1039"
|
15
|
+
data.five_one_arm[:mortgage_insurance].should == "93"
|
16
|
+
data.down_payment.should == "45000"
|
17
|
+
data.monthly_property_taxes.should == "193"
|
18
|
+
data.monthly_hazard_insurance == "50"
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::Posting do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::Postings.new(get_xml('get_region_postings.xml'))
|
6
|
+
data = data.make_me_move[0]
|
7
|
+
|
8
|
+
data.should be_a(Rubillow::Models::Posting)
|
9
|
+
data.zpid.should == "48708109"
|
10
|
+
data.last_refreshed_date.strftime("%m/%d/%Y").should == "08/21/2011"
|
11
|
+
data.links.count.should == 1
|
12
|
+
data.links[:homedetails].should == "http://www.zillow.com/homedetails/1658-Federal-Ave-E-Seattle-WA-98102/48708109_zpid/"
|
13
|
+
data.address[:street].should == "1658 Federal Ave E"
|
14
|
+
data.address[:city].should == "Seattle"
|
15
|
+
data.address[:state].should == "WA"
|
16
|
+
data.address[:zipcode].should == "98102"
|
17
|
+
data.address[:latitude].should == "47.634532"
|
18
|
+
data.address[:longitude].should == "-122.318519"
|
19
|
+
data.use_code.should == "Single Family"
|
20
|
+
data.lot_size_square_feet.should == "20000"
|
21
|
+
data.finished_square_feet.should == "7380"
|
22
|
+
data.bathrooms.should == "5.0"
|
23
|
+
data.bedrooms.should == "6"
|
24
|
+
data.total_rooms.should == ""
|
25
|
+
data.images_count.should == "1"
|
26
|
+
data.price.should == "4500000"
|
27
|
+
end
|
28
|
+
end
|