Created
May 24, 2013 01:43
-
-
Save daguar/5640767 to your computer and use it in GitHub Desktop.
Zillow neighborhood data exploration in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
require 'rubillow' | |
Rubillow.configure do |config| | |
config.zwsid = ENV["ZILLOW_KEY"] | |
end | |
hoods = Rubillow::Neighborhood.region_children({ :state => 'IN', :city => 'South Bend', :childtype => 'neighborhood' }) | |
# Hash method -- not using | |
#hood_region_ids = Hash.new | |
#hoods.regions.each { |r| hood_region_ids[r.parser.children[0].children[0].text] = r.parser.children[0].children[1].text } | |
# Array method -- using | |
hoods_and_ids_array = Array.new | |
hoods.regions.each { |r| hoods_and_ids_array << { :id => r.parser.children[0].children[0].text, :name => r.parser.children[0].children[1].text } } | |
one_hoods_data = Rubillow::Neighborhood.demographics({ :regionid => hoods_and_ids_array[0]["id"], :city => "South Bend", :state => "IN" }) | |
binding.pry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment