Skip to content

Instantly share code, notes, and snippets.

@daguar
Created May 24, 2013 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daguar/5640767 to your computer and use it in GitHub Desktop.
Save daguar/5640767 to your computer and use it in GitHub Desktop.
Zillow neighborhood data exploration in Ruby
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