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
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::Postings do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::Postings.new(get_xml('get_region_postings.xml'))
|
6
|
+
|
7
|
+
data.region_id.should == "99562"
|
8
|
+
data.links.count.should == 3
|
9
|
+
data.make_me_move.count.should == 90
|
10
|
+
data.for_sale_by_owner.count.should == 1
|
11
|
+
data.for_sale_by_agent.count.should == 8
|
12
|
+
data.report_for_sale.count.should == 1
|
13
|
+
data.for_rent.count.should == 1
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::PropertyChart do
|
4
|
+
it "populates the results" do
|
5
|
+
data = Rubillow::Models::PropertyChart.new(get_xml('get_chart.xml'))
|
6
|
+
|
7
|
+
data.width.should == 300
|
8
|
+
data.height.should == 150
|
9
|
+
data.url.should == "http://www.zillow.com/app?chartDuration=1year&chartType=partner&height=150&page=webservice%2FGetChart&service=chart&showPercent=true&width=300&zpid=48749425"
|
10
|
+
data.graphs_and_data.should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should format correctly for HTML" do
|
14
|
+
data = Rubillow::Models::PropertyChart.new(get_xml('get_chart.xml'))
|
15
|
+
|
16
|
+
data.to_html.should == "<a href='http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data'><img src='http://www.zillow.com/app?chartDuration=1year&chartType=partner&height=150&page=webservice%2FGetChart&service=chart&showPercent=true&width=300&zpid=48749425' height='150' width='300' /></a>"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::RateSummary do
|
4
|
+
it "populates the results" do
|
5
|
+
data = Rubillow::Models::RateSummary.new(get_xml('get_rate_summary.xml'))
|
6
|
+
|
7
|
+
data.today[:thiry_year_fixed].should == "4.01"
|
8
|
+
data.today[:fifteen_year_fixed].should == "3.27"
|
9
|
+
data.today[:five_one_arm].should == "2.73"
|
10
|
+
data.last_week[:thiry_year_fixed].should == "4.02"
|
11
|
+
data.last_week[:fifteen_year_fixed].should == "3.27"
|
12
|
+
data.last_week[:five_one_arm].should == "2.84"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::RegionChart do
|
4
|
+
it "populates the results" do
|
5
|
+
data = Rubillow::Models::RegionChart.new(get_xml('get_region_chart.xml'))
|
6
|
+
|
7
|
+
data.width.should == 300
|
8
|
+
data.height.should == 150
|
9
|
+
data.url.should == "http://www.zillow.com/app?chartDuration=1year&chartType=partner&cityRegionId=16037&countyRegionId=0&height=150&nationRegionId=0&neighborhoodRegionId=0&page=webservice%2FGetRegionChart&service=chart&showCity=true&showPercent=true&stateRegionId=0&width=300&zipRegionId=0"
|
10
|
+
data.link.should == "http://www.zillow.com/homes/Seattle-WA/"
|
11
|
+
data.links.count.should == 3
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should format correctly for HTML" do
|
15
|
+
data = Rubillow::Models::RegionChart.new(get_xml('get_region_chart.xml'))
|
16
|
+
|
17
|
+
data.to_html.should == "<a href='http://www.zillow.com/homes/Seattle-WA/'><img src='http://www.zillow.com/app?chartDuration=1year&chartType=partner&cityRegionId=16037&countyRegionId=0&height=150&nationRegionId=0&neighborhoodRegionId=0&page=webservice%2FGetRegionChart&service=chart&showCity=true&showPercent=true&stateRegionId=0&width=300&zipRegionId=0' height='150' width='300' /></a>"
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::RegionChildren do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::RegionChildren.new(get_xml('get_region_children.xml'))
|
6
|
+
|
7
|
+
data.region.id.should == "16037"
|
8
|
+
data.regions.count.should == 107
|
9
|
+
data.regions[0].id.should == "343997"
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::SearchResult do
|
4
|
+
it "populates the results from GetSearchResults" do
|
5
|
+
data = Rubillow::Models::SearchResult.new(get_xml('get_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.full_address.should == "2114 Bigelow Ave N, Seattle, WA 98109"
|
21
|
+
data.price.should == "1032000"
|
22
|
+
data.percentile.should == "0"
|
23
|
+
data.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
24
|
+
data.valuation_range[:low].should == "866880"
|
25
|
+
data.valuation_range[:high].should == "1259040"
|
26
|
+
data.change.should == "5900"
|
27
|
+
data.change_duration.should == "30"
|
28
|
+
data.local_real_estate.count.should == 3
|
29
|
+
data.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/East-Queen-Anne/r_271856/"
|
30
|
+
data.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/East-Queen-Anne-Seattle-WA/"
|
31
|
+
data.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/East-Queen-Anne-Seattle-WA/"
|
32
|
+
data.region.should == "East Queen Anne"
|
33
|
+
data.region_type.should == "neighborhood"
|
34
|
+
data.region_id.should == "271856"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "populates the results from GetZestimate" do
|
38
|
+
data = Rubillow::Models::SearchResult.new(get_xml('get_zestimate.xml'))
|
39
|
+
|
40
|
+
data.zpid.should == '48749425'
|
41
|
+
data.links.count.should == 5
|
42
|
+
data.links[:homedetails].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/"
|
43
|
+
data.links[:graphsanddata].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#charts-and-data"
|
44
|
+
data.links[:mapthishome].should == "http://www.zillow.com/homes/48749425_zpid/"
|
45
|
+
data.links[:myestimator].should == "http://www.zillow.com/myestimator/Edit.htm?zprop=48749425"
|
46
|
+
data.links[:comparables].should == "http://www.zillow.com/homes/comps/48749425_zpid/"
|
47
|
+
data.address[:street].should == "2114 Bigelow Ave N"
|
48
|
+
data.address[:city].should == "Seattle"
|
49
|
+
data.address[:state].should == "WA"
|
50
|
+
data.address[:zipcode].should == "98109"
|
51
|
+
data.address[:latitude].should == "47.637933"
|
52
|
+
data.address[:longitude].should == "-122.347938"
|
53
|
+
data.price.should == "1032000"
|
54
|
+
data.percentile.should == "95"
|
55
|
+
data.last_updated.strftime("%m/%d/%Y").should == "08/24/2011"
|
56
|
+
data.valuation_range[:low].should == "866880"
|
57
|
+
data.valuation_range[:high].should == "1259040"
|
58
|
+
data.change.should == "5900"
|
59
|
+
data.change_duration.should == "30"
|
60
|
+
data.local_real_estate.count.should == 3
|
61
|
+
data.local_real_estate[:overview].should == "http://www.zillow.com/local-info/WA-Seattle/East-Queen-Anne/r_271856/"
|
62
|
+
data.local_real_estate[:for_sale_by_owner].should == "http://www.zillow.com/homes/fsbo/East-Queen-Anne-Seattle-WA/"
|
63
|
+
data.local_real_estate[:for_sale].should == "http://www.zillow.com/homes/for_sale/East-Queen-Anne-Seattle-WA/"
|
64
|
+
data.region.should == "East Queen Anne"
|
65
|
+
data.region_type.should == "neighborhood"
|
66
|
+
data.region_id.should == "271856"
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::UpdatedPropertyDetails do
|
4
|
+
it "populates the data" do
|
5
|
+
data = Rubillow::Models::UpdatedPropertyDetails.new(get_xml('get_updated_property_details.xml'))
|
6
|
+
|
7
|
+
data.zpid.should == '48749425'
|
8
|
+
data.links.count.should == 3
|
9
|
+
data.links[:homeDetails].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/"
|
10
|
+
data.links[:photoGallery].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/#image=lightbox%3Dtrue"
|
11
|
+
data.links[:homeInfo].should == "http://www.zillow.com/homedetails/2114-Bigelow-Ave-N-Seattle-WA-98109/48749425_zpid/"
|
12
|
+
data.address[:street].should == "2114 Bigelow Ave N"
|
13
|
+
data.address[:city].should == "Seattle"
|
14
|
+
data.address[:state].should == "WA"
|
15
|
+
data.address[:zipcode].should == "98109"
|
16
|
+
data.address[:latitude].should == "47.637933"
|
17
|
+
data.address[:longitude].should == "-122.347938"
|
18
|
+
data.page_views[:current_month].should == "27"
|
19
|
+
data.page_views[:total].should == "8095"
|
20
|
+
data.price.should == "1290000"
|
21
|
+
data.neighborhood.should == "Queen Anne"
|
22
|
+
data.school_district.should == "Seattle"
|
23
|
+
data.elementary_school.should == "John Hay"
|
24
|
+
data.middle_school.should == "McClure"
|
25
|
+
data.home_description.should == "Bright, spacious, 4 bedroom/3 bath Craftsman, with stunning, expansive views, on one of Queen Anne's finest streets. Views of Lk Union, Lk Washington,the Cascades from Mt. Baker to Mt. Rainier, and the city-from two levels and 2 view decks. Craftsman charm intact: hardwood floors, cove moldings, crystal doorknobs, Batchelder tile fireplace. Huge gourmet eat-in kitchen with slab granite countertops, deluxe master suite, theater-like media room, level rear yard with garden space and covered patio."
|
26
|
+
data.posting[:status].should == "Active"
|
27
|
+
data.posting[:agent_name].should == "John Blacksmith"
|
28
|
+
data.posting[:agent_profile_url].should == "/profile/John.Blacksmith"
|
29
|
+
data.posting[:brokerage].should == "Lake and Company Real Estate"
|
30
|
+
data.posting[:type].should == "For sale by agent"
|
31
|
+
data.posting[:last_updated_date].should == "2008-06-05 10:28:00.0"
|
32
|
+
data.posting[:external_url].should == "http://mls.lakere.com/srch_mls/detail.php?mode=ag&LN=28097669&t=listings&l="
|
33
|
+
data.posting[:mls].should == "28097669"
|
34
|
+
data.images_count.should == "17"
|
35
|
+
data.images.count.should == 5
|
36
|
+
data.images[0].should == "http://photos1.zillow.com/is/image/i0/i4/i3019/IS1d2piz9kupb4z.jpg?op_sharpen=1&qlt=90&hei=400&wid=400"
|
37
|
+
data.images[1].should == "http://photos3.zillow.com/is/image/i0/i4/i3019/ISkzzhgcun7u03.jpg?op_sharpen=1&qlt=90&hei=400&wid=400"
|
38
|
+
data.images[2].should == "http://photos2.zillow.com/is/image/i0/i4/i3019/ISkzzhg8wkzq1v.jpg?op_sharpen=1&qlt=90&hei=400&wid=400"
|
39
|
+
data.images[3].should == "http://photos1.zillow.com/is/image/i0/i4/i3019/ISkzzhg4yirm3n.jpg?op_sharpen=1&qlt=90&hei=400&wid=400"
|
40
|
+
data.images[4].should == "http://photos3.zillow.com/is/image/i0/i4/i3019/ISkzzhg10gji5f.jpg?op_sharpen=1&qlt=90&hei=400&wid=400"
|
41
|
+
data.edited_facts[:use_code].should == "SingleFamily"
|
42
|
+
data.edited_facts[:bedrooms].should == "4"
|
43
|
+
data.edited_facts[:bathrooms].should == "3.0"
|
44
|
+
data.edited_facts[:finished_sq_ft].should == "3470"
|
45
|
+
data.edited_facts[:lot_size_sq_ft].should == "4680"
|
46
|
+
data.edited_facts[:year_built].should == "1924"
|
47
|
+
data.edited_facts[:year_updated].should == "2003"
|
48
|
+
data.edited_facts[:num_floors].should == "2"
|
49
|
+
data.edited_facts[:basement].should == "Finished"
|
50
|
+
data.edited_facts[:roof].should == "Composition"
|
51
|
+
data.edited_facts[:view].should == "Water, City, Mountain"
|
52
|
+
data.edited_facts[:parking_type].should == "Off-street"
|
53
|
+
data.edited_facts[:heating_sources].should == "Gas"
|
54
|
+
data.edited_facts[:heating_system].should == "Forced air"
|
55
|
+
data.edited_facts[:rooms].should == "Laundry room, Walk-in closet, Master bath, Office, Dining room, Family room, Breakfast nook"
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Models::Base do
|
4
|
+
it "catches error responses" do
|
5
|
+
data = Rubillow::Models::Base.new(get_xml('general_failure.xml'))
|
6
|
+
|
7
|
+
data.code.should == 2
|
8
|
+
data.message.should == "Error: invalid or missing ZWSID parameter"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "catches near limit warning" do
|
12
|
+
data = Rubillow::Models::Base.new(get_xml('near_limit.xml'))
|
13
|
+
|
14
|
+
data.near_limit.should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "fails if empty XML" do
|
18
|
+
data = Rubillow::Models::Base.new("")
|
19
|
+
|
20
|
+
data.success?.should be_false
|
21
|
+
data.code.should == -1
|
22
|
+
data.message.should == "Error connecting to remote service."
|
23
|
+
end
|
24
|
+
|
25
|
+
it "fails if nil XML" do
|
26
|
+
data = Rubillow::Models::Base.new(nil)
|
27
|
+
|
28
|
+
data.success?.should be_false
|
29
|
+
data.code.should == -1
|
30
|
+
data.message.should == "Error connecting to remote service."
|
31
|
+
end
|
32
|
+
|
33
|
+
it "fails if passed false" do
|
34
|
+
data = Rubillow::Models::Base.new(false)
|
35
|
+
|
36
|
+
data.success?.should be_false
|
37
|
+
data.code.should == -1
|
38
|
+
data.message.should == "Error connecting to remote service."
|
39
|
+
end
|
40
|
+
|
41
|
+
it "saves raw XML" do
|
42
|
+
data = Rubillow::Models::Base.new(get_xml('near_limit.xml'))
|
43
|
+
|
44
|
+
data.xml.should == get_xml('near_limit.xml')
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Mortgage, ".rate_summary" do
|
4
|
+
let(:request) { stub("Request", :get => response) }
|
5
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
6
|
+
|
7
|
+
it "fetches the XML" do
|
8
|
+
Rubillow::Request.stubs(:request).returns(request)
|
9
|
+
|
10
|
+
response = Rubillow::Mortgage.rate_summary()
|
11
|
+
response.should be_an_instance_of(Rubillow::Models::RateSummary)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe Rubillow::Mortgage, ".monthly_payments" do
|
16
|
+
let(:request) { stub("Request", :get => response) }
|
17
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
18
|
+
|
19
|
+
it "requires the price option" do
|
20
|
+
lambda {
|
21
|
+
Rubillow::Mortgage.monthly_payments()
|
22
|
+
}.should raise_error(ArgumentError, "The price option is required")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "requires either the down or dollars down option" do
|
26
|
+
lambda {
|
27
|
+
Rubillow::Mortgage.monthly_payments({ :price => "300000" })
|
28
|
+
}.should raise_error(ArgumentError, "Either the down or dollarsdown option is required")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "fetches the XML" do
|
32
|
+
Rubillow::Request.stubs(:request).returns(request)
|
33
|
+
|
34
|
+
response = Rubillow::Mortgage.monthly_payments({ :price => "300000", :down => "15", :zip => "98104" })
|
35
|
+
response.should be_an_instance_of(Rubillow::Models::MonthlyPayments)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Neighborhood, ".demographics" do
|
4
|
+
let(:request) { stub("Request", :get => response) }
|
5
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
6
|
+
|
7
|
+
it "requires either the regionid, state and city, city and neighborhood, or zip option" do
|
8
|
+
lambda {
|
9
|
+
Rubillow::Neighborhood.demographics()
|
10
|
+
}.should raise_error(ArgumentError, "The regionid, state and city, city and neighborhood or zip option is required")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "fetches the XML" do
|
14
|
+
Rubillow::Request.stubs(:request).returns(request)
|
15
|
+
|
16
|
+
response = Rubillow::Neighborhood.demographics({ :state => 'WA', :city => 'Seattle', :neighborhood => 'Ballard' })
|
17
|
+
response.should be_an_instance_of(Rubillow::Models::Demographics)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Rubillow::Neighborhood, ".region_children" do
|
22
|
+
let(:request) { stub("Request", :get => response) }
|
23
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
24
|
+
|
25
|
+
it "requires either the regionid or state option" do
|
26
|
+
lambda {
|
27
|
+
Rubillow::Neighborhood.region_children()
|
28
|
+
}.should raise_error(ArgumentError, "The regionid or state option is required")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "fetches the XML" do
|
32
|
+
Rubillow::Request.stubs(:request).returns(request)
|
33
|
+
|
34
|
+
response = Rubillow::Neighborhood.region_children({ :state => 'WA', :city => 'Seattle', :childtype => 'neighborhood' })
|
35
|
+
response.should be_an_instance_of(Rubillow::Models::RegionChildren)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe Rubillow::Neighborhood, ".region_chart" do
|
40
|
+
let(:request) { stub("Request", :get => response) }
|
41
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
42
|
+
|
43
|
+
it "requires the unit_type option" do
|
44
|
+
lambda {
|
45
|
+
Rubillow::Neighborhood.region_chart()
|
46
|
+
}.should raise_error(ArgumentError, "The unit_type option is required")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "fetches the XML" do
|
50
|
+
Rubillow::Request.stubs(:request).returns(request)
|
51
|
+
|
52
|
+
response = Rubillow::Neighborhood.region_chart({ :city => 'Seattle', :state => 'WA', :unit_type => 'percent', :width => 300, :height => 150 })
|
53
|
+
response.should be_an_instance_of(Rubillow::Models::RegionChart)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::Postings, ".region_postings" do
|
4
|
+
let(:request) { stub("Request", :get => response) }
|
5
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
6
|
+
|
7
|
+
it "requires either the zipcode or citystatezip option" do
|
8
|
+
lambda {
|
9
|
+
Rubillow::Postings.region_postings()
|
10
|
+
}.should raise_error(ArgumentError, "Either the zipcode or citystatezip option is required")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "fetches the XML" do
|
14
|
+
Rubillow::Request.stubs(:request).returns(request)
|
15
|
+
|
16
|
+
response = Rubillow::Postings.region_postings({ :zipcode => "98102", :rental => true })
|
17
|
+
response.should be_an_instance_of(Rubillow::Models::Postings)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Rubillow::PropertyDetails, ".deep_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::PropertyDetails.deep_search_results({ :citystatezip => 'Baton Rouge, LA, 70802' })
|
10
|
+
}.should raise_error(ArgumentError, "The address option is required")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "requires the citystatezip option" do
|
14
|
+
lambda {
|
15
|
+
Rubillow::PropertyDetails.deep_search_results({ :address => '100 North Blvd' })
|
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::PropertyDetails.deep_search_results({ :address => '2114 Bigelow Ave', :citystatezip => 'Seattle, WA' })
|
23
|
+
response.should be_an_instance_of(Rubillow::Models::DeepSearchResult)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe Rubillow::PropertyDetails, ".deep_comps" 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::PropertyDetails.deep_comps()
|
34
|
+
}.should raise_error(ArgumentError, "The zpid option is required")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "requires the count option" do
|
38
|
+
lambda {
|
39
|
+
Rubillow::PropertyDetails.deep_comps({ :zpid => '48749425' })
|
40
|
+
}.should raise_error(ArgumentError, "The count option is required")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "fetches the XML" do
|
44
|
+
Rubillow::Request.stubs(:request).returns(request)
|
45
|
+
|
46
|
+
response = Rubillow::PropertyDetails.deep_comps({ :zpid => '48749425', :count => 5 })
|
47
|
+
response.should be_an_instance_of(Rubillow::Models::DeepComps)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe Rubillow::PropertyDetails, ".updated_property_details" do
|
52
|
+
let(:request) { stub("Request", :get => response) }
|
53
|
+
let(:response) { stub("Response", :body => "", :code => 200) }
|
54
|
+
|
55
|
+
it "requires the zpid option" do
|
56
|
+
lambda {
|
57
|
+
Rubillow::PropertyDetails.updated_property_details()
|
58
|
+
}.should raise_error(ArgumentError, "The zpid option is required")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "fetches the XML" do
|
62
|
+
Rubillow::Request.stubs(:request).returns(request)
|
63
|
+
|
64
|
+
response = Rubillow::PropertyDetails.updated_property_details({ :zpid => '48749425' })
|
65
|
+
response.should be_an_instance_of(Rubillow::Models::UpdatedPropertyDetails)
|
66
|
+
end
|
67
|
+
end
|