zillow_demographics 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +36 -2
- data/lib/zillow_demographics.rb +1 -0
- data/lib/zillow_demographics/national.rb +4 -5
- data/lib/zillow_demographics/people.rb +2 -2
- data/lib/zillow_demographics/version.rb +1 -1
- data/spec/client_spec.rb +2 -2
- data/spec/fixtures/chicago_sample_response.xml +2 -0
- data/spec/fixtures/invalid_response.xml +1 -0
- data/spec/national_spec.rb +48 -0
- data/spec/people_spec.rb +61 -19
- metadata +14 -8
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# ZillowDemographics
|
2
2
|
|
3
|
-
|
3
|
+
This is a gem for consuming the Zillow Api. Zillow is an online real estate company that is best known for providing pricing information on homes. A lesser known service that they provide is demographic information on cities and neighborhoods. They compile census data with their own internally gathered data to provide statistics like median age of residents for a city, percentage of single male and females, average home size etc...
|
4
|
+
|
5
|
+
When creating this gem, I was only concerned with the demographic info Zillow provides. There is much more to their API, which I hope to cover in the coming months. To use this gem you will need to first sign up for a api key with Zillow. That can be found at this link: https://www.zillow.com/webservice/Registration.htm
|
6
|
+
|
7
|
+
Use this gem if you need this type of information
|
8
|
+
+ Percentage of Single Males
|
9
|
+
+ Percentage of Single Females
|
10
|
+
+ Median Age
|
11
|
+
+ Average Commute Time to Work
|
12
|
+
+ Main Mode of Transportation Within the City
|
13
|
+
+ Average Home Value
|
14
|
+
+ Categorization of the Types of People of Live Within the City
|
4
15
|
|
5
16
|
## Installation
|
6
17
|
|
@@ -18,7 +29,30 @@ Or install it yourself as:
|
|
18
29
|
|
19
30
|
## Usage
|
20
31
|
|
21
|
-
|
32
|
+
The gem is structured so that it returns two class types: People and National.
|
33
|
+
#### People
|
34
|
+
Is the local data for the city you are interested in.
|
35
|
+
#### National
|
36
|
+
Is the same data, but for the whole US.
|
37
|
+
|
38
|
+
Each class has a single method for interacting with the data.
|
39
|
+
#### class People Example
|
40
|
+
ZillowApi::People.find_by_city('Chicago', API_KEY) #=> returns an instance of the People class with these attributes:
|
41
|
+
* single_males (string)
|
42
|
+
* single_females (string)
|
43
|
+
* median_age (string)
|
44
|
+
* average_commute_time (string)
|
45
|
+
* transportation (array)
|
46
|
+
* home_value (string)
|
47
|
+
* who_live_here (hash)
|
48
|
+
|
49
|
+
#### class National Example
|
50
|
+
ZillowApi::People.find(API_KEY) #=> returns an instance of the National class with these attributes:
|
51
|
+
* single_males (string)
|
52
|
+
* single_females (string)
|
53
|
+
* median_age (string)
|
54
|
+
* average_commute_time (string)
|
55
|
+
* home_value (string)
|
22
56
|
|
23
57
|
## Contributing
|
24
58
|
|
data/lib/zillow_demographics.rb
CHANGED
@@ -18,31 +18,30 @@ module ZillowApi
|
|
18
18
|
ZillowApi::Client.new
|
19
19
|
end
|
20
20
|
|
21
|
-
def demo_attributes(location, api_key)
|
21
|
+
def demo_attributes(location='chicago', api_key)
|
22
22
|
keys = parsed_response(location, api_key).search("page")[-1].search("table")[0].search("attribute").map {|key| key.child.text.downcase }
|
23
23
|
values = parsed_response(location, api_key).search("page")[-1].search("table")[0].search("attribute").search("nation").map { |values| values.child.text }
|
24
24
|
Hash[keys.zip(values)]
|
25
25
|
end
|
26
26
|
|
27
|
-
def home_value(location, api_key)
|
27
|
+
def home_value(location='chicago', api_key)
|
28
28
|
key = parsed_response(location, api_key).search("page").first.search("data").first.search("attribute").first.child.text.downcase
|
29
29
|
value = parsed_response(location, api_key).search("page").first.search("data").first.search("nation").first.text
|
30
30
|
{ key => value }
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def find(location='chicago', api_key)
|
34
34
|
attributes = demo_attributes(location, api_key).merge(home_value(location, api_key))
|
35
35
|
ZillowApi::National.new(attributes)
|
36
36
|
end
|
37
37
|
|
38
|
-
def parsed_response(location, api_key)
|
38
|
+
def parsed_response(location='chicago', api_key)
|
39
39
|
parse_all(client.get_city_data(location, api_key))
|
40
40
|
end
|
41
41
|
|
42
42
|
def parse_all(xml_package)
|
43
43
|
Nokogiri::HTML(xml_package)
|
44
44
|
end
|
45
|
-
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
@@ -2,8 +2,8 @@ require 'nokogiri'
|
|
2
2
|
|
3
3
|
module ZillowApi
|
4
4
|
class People
|
5
|
-
attr_accessor :single_males, :single_females, :median_age, :average_commute_time
|
6
|
-
|
5
|
+
attr_accessor :single_males, :single_females, :median_age, :average_commute_time,
|
6
|
+
:transportation, :home_value, :who_live_here
|
7
7
|
|
8
8
|
def initialize(attributes)
|
9
9
|
self.average_commute_time = attributes['average commute time (minutes)']
|
data/spec/client_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe ZillowApi::Client do
|
|
12
12
|
describe "#get_city_data" do
|
13
13
|
context "when given a hash including a valid city and state" do
|
14
14
|
it "returns an xml package of data for the specified city" do
|
15
|
-
response = Nokogiri::HTML(client.get_city_data(VALID_CITY))
|
15
|
+
response = Nokogiri::HTML(client.get_city_data(VALID_CITY, ZWSID))
|
16
16
|
message = response.search("message").children.first.text
|
17
17
|
message.should == REQUEST['0']
|
18
18
|
end
|
@@ -20,7 +20,7 @@ describe ZillowApi::Client do
|
|
20
20
|
|
21
21
|
context "when given an invalid hash" do
|
22
22
|
it "returns an error message" do
|
23
|
-
response = Nokogiri::HTML(client.get_city_data(INVALID_CITY))
|
23
|
+
response = Nokogiri::HTML(client.get_city_data(INVALID_CITY, ZWSID))
|
24
24
|
message = response.search("message").children.first.text
|
25
25
|
message.should == REQUEST['1']
|
26
26
|
end
|
@@ -0,0 +1,2 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="utf-8"?><Demographics:demographics xmlns:Demographics="http://www.zillow.com/static/xsd/Demographics.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zillow.com/static/xsd/Demographics.xsd http://www.zillowstatic.com/vstatic/bfadcf87ed20c39d98fdb23bb22b7bde/static/xsd/Demographics.xsd"><request><state>Il</state><city>chicago</city></request><message><text>Request successfully processed</text><code>0</code></message><response><region><id>17426</id><state>Illinois</state><city>Chicago</city><latitude>41.833734</latitude><longitude>-87.731963</longitude><zmmrateurl>http://www.zillow.com/mortgage-rates/il/chicago/</zmmrateurl></region><links><main>http://www.zillow.com/homes/Chicago-IL/</main><affordability>http://www.zillow.com/local-info/IL-Chicago-home-value/r_17426/</affordability><homesandrealestate>http://www.zillow.com/local-info/IL-Chicago-homes/r_17426/</homesandrealestate><people>http://www.zillow.com/local-info/IL-Chicago-people/r_17426/</people><forSale>http://www.zillow.com/homes/for_sale/Chicago-IL/</forSale><forSaleByOwner>http://www.zillow.com/homes/fsbo/Chicago-IL/</forSaleByOwner><foreclosures>http://www.zillow.com/homes/for_sale/Chicago-IL/fore_lt/0_mmm/</foreclosures><recentlySold>http://www.zillow.com/homes/recently_sold/Chicago-IL/</recentlySold></links><charts><chart><name>Median Condo Value</name><url>http://www.zillow.com/app?chartType=affordability_avgCondoValue&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name>Median Home Value</name><url>http://www.zillow.com/app?chartType=affordability_avgHomeValue&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name>Dollars Per Square Feet</name><url>http://www.zillow.com/app?chartType=affordability_pricePerSqft&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name deprecated="true">Zillow Home Value Index Distribution</name><url>http://www.zillow.com/app?chartType=affordability_ZindexByDistribution&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name>Home Type</name><url>http://www.zillow.com/app?chartType=home_homeType&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name deprecated="true">Owners vs. Renters</name><url>http://www.zillow.com/app?chartType=home_ownVsRent&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name>Home Size in Square Feet</name><url>http://www.zillow.com/app?chartType=home_homeSize&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart><chart><name>Year Built</name><url>http://www.zillow.com/app?chartType=home_yearBuilt&graphType=barChart&regionId=17426&regionType=6&service=chart</url></chart></charts><market deprecated="true"></market><pages><page><name>Affordability</name><tables><table><name>Affordability Data</name><data><attribute><name>Zillow Home Value Index</name><values><city><value type="USD">157100</value></city><nation><value type="USD">148100</value></nation></values></attribute><attribute><name>Median Single Family Home Value</name><values><city><value type="USD">135200</value></city><nation><value type="USD">148200</value></nation></values></attribute><attribute><name>Median Condo Value</name><values><city><value type="USD">181800</value></city><nation><value type="USD">147000</value></nation></values></attribute><attribute><name>Median 2-Bedroom Home Value</name><values><city><value type="USD">232300</value></city><nation><value type="USD">111000</value></nation></values></attribute><attribute><name>Median 3-Bedroom Home Value</name><values><city><value type="USD">211700</value></city><nation><value type="USD">142000</value></nation></values></attribute><attribute><name>Median 4-Bedroom Home Value</name><values><city><value type="USD">201300</value></city><nation><value type="USD">232800</value></nation></values></attribute><attribute><name>Percent Homes Decreasing</name><values><city><value type="percent">0.64</value></city><nation><value type="percent">0.517</value></nation></values></attribute><attribute><name>Percent Listing Price Reduction</name><values><city><value type="percent">0.334</value></city><nation><value type="percent">0.308</value></nation></values></attribute><attribute><name>Median List Price Per Sq Ft</name><values><city><value type="USD">119</value></city><nation><value type="USD">93</value></nation></values></attribute><attribute><name>Median List Price</name><values><city><value type="USD">214500</value></city><nation><value type="USD">189000</value></nation></values></attribute><attribute><name>Median Sale Price</name><values><city><value type="USD">204000</value></city><nation><value type="USD">190700</value></nation></values></attribute><attribute><name>Homes For Sale</name><values></values></attribute><attribute><name>Homes Recently Sold</name><values><city><value>1952</value></city><nation><value>300667</value></nation></values></attribute><attribute><name>Property Tax</name><values><city><value type="USD">2537</value></city><nation><value type="USD">2111</value></nation></values></attribute><attribute><name>Turnover (Sold Within Last Yr.)</name><values><city><value type="percent">0.033</value></city><nation><value type="percent">0.033</value></nation></values></attribute><attribute><name>Median Value Per Sq Ft</name><values><city><value type="USD">166</value></city><nation><value type="USD">107</value></nation></values></attribute><attribute><name>1-Yr. Change</name><values><city><value type="percent">-0.081</value></city><nation><value type="percent">-0.009</value></nation></values></attribute><attribute><name>Homes For Sale By Owner</name><values><city><value>203</value></city><nation><value>55716</value></nation></values></attribute><attribute><name>New Construction</name><values><city><value>0</value></city><nation><value>43724</value></nation></values></attribute><attribute><name>Foreclosures</name><values><city><value>16773</value></city><nation><value>551626</value></nation></values></attribute></data></table></tables></page><page><name>Homes & Real Estate</name><tables><table><name>Homes & Real Estate Data</name><data><attribute><name>Owners</name><values><city><value type="percent">0.43780281</value></city><nation><value type="percent">0.66268764</value></nation></values></attribute><attribute><name>Renters</name><values><city><value type="percent">0.56219719</value></city><nation><value type="percent">0.33731236</value></nation></values></attribute><attribute><name>Median Home Size (Sq. Ft.)</name><values></values></attribute><attribute><name>Avg. Year Built</name><values></values></attribute><attribute><name>Single-Family Homes</name><values><city><value type="percent">0.3643910539408</value></city></values></attribute><attribute><name>Condos</name><values><city><value type="percent">0.377262164682</value></city></values></attribute></data></table><table><name>Census Summary-HomeType</name><data><attribute><name>Condo</name><value type="percent">0.377262164682</value></attribute><attribute><name>Other</name><value type="percent">0.258346781377</value></attribute><attribute><name>SingleFamily</name><value type="percent">0.3643910539408</value></attribute></data></table><table><name>Census Summary-Occupancy</name><data><attribute><name>Own</name><value type="percent">0.43780281</value></attribute><attribute><name>Rent</name><value type="percent">0.56219719</value></attribute></data></table></tables></page><page><name>People</name><tables><table><name>People Data</name><data><attribute><name>Median Household Income</name><values><city><value currency="USD">38625</value></city><nation><value currency="USD">44512.0130806292</value></nation></values></attribute><attribute><name>Single Males</name><values><city><value type="percent">0.210184780949744</value></city><nation><value type="percent">0.146462187349365</value></nation></values></attribute><attribute><name>Single Females</name><values><city><value type="percent">0.198669690742141</value></city><nation><value type="percent">0.124578258618535</value></nation></values></attribute><attribute><name>Median Age</name><values><city><value>33</value></city><nation><value>36</value></nation></values></attribute><attribute><name>Homes With Kids</name><values><city><value type="percent">0.285350539189652</value></city><nation><value type="percent">0.313623902816284</value></nation></values></attribute><attribute><name>Average Household Size</name><values><city><value>2.67</value></city><nation><value>2.58883240001203</value></nation></values></attribute><attribute><name>Average Commute Time (Minutes)</name><values><city><value>35.44053647246415</value></city><nation><value>26.375545725891282</value></nation></values></attribute></data></table><table><name>Census Summary-AgeDecade</name><data><attribute><name>>=70s</name><value type="percent">0.0744943652614466</value></attribute><attribute><name>0s</name><value type="percent">0.151585447885402</value></attribute><attribute><name>10s</name><value type="percent">0.138165046250575</value></attribute><attribute><name>20s</name><value type="percent">0.179808865027328</value></attribute><attribute><name>30s</name><value type="percent">0.165776922641304</value></attribute><attribute><name>40s</name><value type="percent">0.135392567034673</value></attribute><attribute><name>50s</name><value type="percent">0.0918530064600251</value></attribute><attribute><name>60s</name><value type="percent">0.0629237794392472</value></attribute></data></table><table><name>Census Summary-CommuteTime</name><data><attribute><name><10min</name><value type="percent">0.056471192655506</value></attribute><attribute><name>>=60min</name><value type="percent">0.159601503126358</value></attribute><attribute><name>10-20min</name><value type="percent">0.180179282355104</value></attribute><attribute><name>20-30min</name><value type="percent">0.174233273251808</value></attribute><attribute><name>30-45min</name><value type="percent">0.222413043590321</value></attribute><attribute><name>45-60min</name><value type="percent">0.207101705020903</value></attribute></data></table><table><name>Census Summary-Household</name><data><attribute><name>NoKids</name><value type="percent">0.714649460810348</value></attribute><attribute><name>WithKids</name><value type="percent">0.285350539189652</value></attribute></data></table><table><name>Census Summary-RelationshipStatus</name><data><attribute><name>Divorced-Female</name><value type="percent">0.0519221690997696</value></attribute><attribute><name>Divorced-Male</name><value type="percent">0.0360218145162721</value></attribute><attribute><name>Married-Female</name><value type="percent">0.21520538512595</value></attribute><attribute><name>Married-Male</name><value type="percent">0.218168677392906</value></attribute><attribute><name>Single-Female</name><value type="percent">0.198669690742141</value></attribute><attribute><name>Single-Male</name><value type="percent">0.210184780949744</value></attribute><attribute><name>Widowed-Female</name><value type="percent">0.0566437376437057</value></attribute><attribute><name>Widowed-Male</name><value type="percent">0.0131837445295114</value></attribute></data></table></tables><segmentation><liveshere><title>Non-native Newbies</title><name>Foreign-born individuals who just moved to U.S.</name><description>A significant proportion of people who have moved to the U.S. from Puerto Rico, the U.S. Island Areas, or a foreign country. Wide age range. Some have a high school or college education, and they work in a variety of occupations.</description></liveshere><liveshere><title>Power Singles</title><name>High-income urban singles.</name><description>Highly educated professionals, many with advanced degrees. They draw a handsome salary and have reasonable living expenses while living a hip, upscale life in an urban center. </description></liveshere><liveshere><title>Melting Pot</title><name>Low-income, foreign-language-speaking urbanites.</name><description>Lower-income population mainly employed in service jobs. Most have a high school education or lower.</description></liveshere><liveshere><title>Makin' It Singles</title><name>Upper-scale urban singles.</name><description>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.</description></liveshere><liveshere><title>Bright Lights, Big City</title><name>Very mobile singles living in the city.</name><description>Singles ranging in age from early 20s to mid-40s who have moved to an urban setting. Most rent their apartment or condo. Some have a college education and work in services and the professional sector.</description></liveshere></segmentation><uniqueness><category type="Education"><characteristic>Bachelor's degrees</characteristic><characteristic>Did not complete high school</characteristic></category><category type="Income"><characteristic>High rent compared to income</characteristic></category><category type="People & Culture"><characteristic>Single females</characteristic><characteristic>Single males</characteristic><characteristic>Speak Spanish or Spanish Creole</characteristic><characteristic>Wealthy retirees</characteristic></category><category type="Transportation"><characteristic>Carpool to work</characteristic><characteristic>Get to work by bus</characteristic><characteristic>Get to work by subway</characteristic></category></uniqueness></page></pages></response></Demographics:demographics><!-- H:018 T:326ms S:7124 R:Sun Jul 08 17:54:46 PDT 2012 B:3.0.156798.20120705140543404-comp_rel_a -->
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><Demographics:demographics xmlns:Demographics="http://www.zillow.com/static/xsd/Demographics.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zillow.com/static/xsd/Demographics.xsd http://www.zillowstatic.com/vstatic/bfadcf87ed20c39d98fdb23bb22b7bde/static/xsd/Demographics.xsd"><request><state>Il</state><city>chicago</city></request><message><text>Error: invalid or missing ZWSID parameter</text><code>2</code></message></Demographics:demographics><!-- H:020 T:17ms S:130 R:Sun Jul 08 18:57:17 PDT 2012 B:3.0.156798.20120705140543404-comp_rel_a -->
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ZillowApi::National do
|
4
|
+
let(:chicago_response) { File.open("spec/fixtures/chicago_sample_response.xml") }
|
5
|
+
# let(:invalid_response) { File.open("spec/fixtures/invalid_response.xml")}
|
6
|
+
|
7
|
+
context "when receiving an xml response" do
|
8
|
+
describe '.parse_all(xml_package)' do
|
9
|
+
it 'returns a nokogiri parsed object' do
|
10
|
+
ZillowApi::National.parse_all(chicago_response).should be_a(Nokogiri::HTML::Document)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
ZillowApi::National.stub(:parsed_response).and_return(Nokogiri::HTML(chicago_response))
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.demo_attributes(api_key)' do
|
19
|
+
it 'returns a hash of demographic info related to the city' do
|
20
|
+
ZillowApi::National.demo_attributes(ZWSID).should be_a(Hash)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'contains 7 keys' do
|
24
|
+
ZillowApi::National.demo_attributes(ZWSID).keys.count.should == 7
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'returns the correct value for median age' do
|
28
|
+
ZillowApi::National.demo_attributes(ZWSID)['median age'].should == "36"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe ".home_value(api_key)" do
|
33
|
+
it 'returns a hash' do
|
34
|
+
ZillowApi::National.home_value(ZWSID).should be_a(Hash)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "contains the key 'zillow home value index'" do
|
38
|
+
ZillowApi::National.home_value(ZWSID).keys.should include 'zillow home value index'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe ".find(api_key)" do
|
43
|
+
it "returns an instance of the ZillowApi::People class" do
|
44
|
+
ZillowApi::National.find(ZWSID).should be_a(ZillowApi::National)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/people_spec.rb
CHANGED
@@ -1,32 +1,74 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe ZillowApi::People do
|
4
|
+
let(:chicago_response) { File.open("spec/fixtures/chicago_sample_response.xml") }
|
5
|
+
# let(:invalid_response) { File.open("spec/fixtures/invalid_response.xml")}
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
context "when receiving an xml response" do
|
8
|
+
describe '.parse_all(xml_package)' do
|
9
|
+
it 'returns a nokogiri parsed object' do
|
10
|
+
ZillowApi::People.parse_all(chicago_response).should be_a(Nokogiri::HTML::Document)
|
11
|
+
end
|
12
|
+
end
|
8
13
|
|
9
|
-
|
10
|
-
|
11
|
-
|
14
|
+
before(:each) do
|
15
|
+
ZillowApi::People.stub(:parsed_response).and_return(Nokogiri::HTML(chicago_response))
|
16
|
+
end
|
12
17
|
|
13
|
-
|
14
|
-
|
18
|
+
describe '.demo_attributes(location, api_key)' do
|
19
|
+
it 'returns a hash of demographic info related to the city' do
|
20
|
+
ZillowApi::People.demo_attributes('chicago', ZWSID).should be_a(Enumerable)
|
21
|
+
end
|
15
22
|
|
16
|
-
|
17
|
-
|
23
|
+
it 'contains 7 keys' do
|
24
|
+
ZillowApi::People.demo_attributes('chicago', ZWSID).keys.count.should == 7
|
25
|
+
end
|
18
26
|
|
19
|
-
|
20
|
-
|
27
|
+
it 'returns the correct value for median age' do
|
28
|
+
ZillowApi::People.demo_attributes('chicago', ZWSID)['median age'].should == "33"
|
29
|
+
end
|
30
|
+
end
|
21
31
|
|
22
|
-
|
23
|
-
|
32
|
+
describe '.lives_here_attributes(location, api_key)' do
|
33
|
+
it 'returns a hash' do
|
34
|
+
ZillowApi::People.lives_here_attributes("chicago", ZWSID).should be_a(Hash)
|
35
|
+
end
|
24
36
|
|
25
|
-
|
26
|
-
|
37
|
+
it "contains the key 'lives here'" do
|
38
|
+
ZillowApi::People.lives_here_attributes("chicago", ZWSID).keys.should include 'lives here'
|
39
|
+
end
|
27
40
|
|
28
|
-
|
29
|
-
|
41
|
+
context "when looking at the value for the 'lives here' key" do
|
42
|
+
it "returns a hash" do
|
43
|
+
ZillowApi::People.lives_here_attributes("chicago", ZWSID)['lives here'].should be_a(Hash)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe ".mode_of_transit(location, api_key)" do
|
49
|
+
it 'returns a hash' do
|
50
|
+
ZillowApi::People.mode_of_transit("chicago", ZWSID).should be_a(Hash)
|
51
|
+
end
|
30
52
|
|
53
|
+
it "contains a key called 'transportation'" do
|
54
|
+
ZillowApi::People.mode_of_transit("chicago", ZWSID).keys.should include 'transportation'
|
55
|
+
end
|
56
|
+
end
|
31
57
|
|
58
|
+
describe ".home_value(location, api_key)" do
|
59
|
+
it 'returns a hash' do
|
60
|
+
ZillowApi::People.home_value("chicago", ZWSID).should be_a(Hash)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "contains the key 'zillow home value index'" do
|
64
|
+
ZillowApi::People.home_value("chicago", ZWSID).keys.should include 'zillow home value index'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe ".find_by_city(location, api_key" do
|
69
|
+
it "returns an instance of the ZillowApi::People class" do
|
70
|
+
ZillowApi::People.find_by_city("chicago", ZWSID).should be_a(ZillowApi::People)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
32
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zillow_demographics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
|
-
requirement: &
|
16
|
+
requirement: &70264227554380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70264227554380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70264227553000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70264227553000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70264227551640 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70264227551640
|
47
47
|
description: wrapper for the zillow_demographics api
|
48
48
|
email:
|
49
49
|
- michael.v.verdi@gmail.com
|
@@ -62,6 +62,9 @@ files:
|
|
62
62
|
- lib/zillow_demographics/people.rb
|
63
63
|
- lib/zillow_demographics/version.rb
|
64
64
|
- spec/client_spec.rb
|
65
|
+
- spec/fixtures/chicago_sample_response.xml
|
66
|
+
- spec/fixtures/invalid_response.xml
|
67
|
+
- spec/national_spec.rb
|
65
68
|
- spec/people_spec.rb
|
66
69
|
- spec/spec_helper.rb
|
67
70
|
- version.rb
|
@@ -92,5 +95,8 @@ specification_version: 3
|
|
92
95
|
summary: wrapper for the zillow_demographics api
|
93
96
|
test_files:
|
94
97
|
- spec/client_spec.rb
|
98
|
+
- spec/fixtures/chicago_sample_response.xml
|
99
|
+
- spec/fixtures/invalid_response.xml
|
100
|
+
- spec/national_spec.rb
|
95
101
|
- spec/people_spec.rb
|
96
102
|
- spec/spec_helper.rb
|