Module: Zillow4r

Defined in:
lib/zillow4r.rb,
lib/zillow4r/api.rb,
lib/zillow4r/models.rb,
lib/zillow4r/api/base.rb,
lib/zillow4r/api/chart.rb,
lib/zillow4r/api/comps.rb,
lib/zillow4r/api/zestimate.rb,
lib/zillow4r/api/deep_comps.rb,
lib/zillow4r/api/demographics.rb,
lib/zillow4r/api/region_chart.rb,
lib/zillow4r/api/search_results.rb,
lib/zillow4r/api/region_children.rb,
lib/zillow4r/api/deep_search_results.rb,
lib/zillow4r/api/updated_property_details.rb

Defined Under Namespace

Modules: Api, XmlSearchHelper Classes: Address, Base, ComparableProperty, Images, Links, Posting, Property, Region, Zestimate

Constant Summary collapse

HTTP_USER_AGENT =
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1"
HTTP_ACCEPT =
"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
WEB_API_HOST =
"www.zillow.com"
WEB_API_PORT =
80

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.zws_idObject

Returns the value of attribute zws_id.



13
14
15
# File 'lib/zillow4r.rb', line 13

def zws_id
  @zws_id
end

Class Method Details

.build_path(klass, params) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/zillow4r.rb', line 30

def build_path(klass, params)
  p = ["zws-id=#{Zillow4r.zws_id}"]
  params.each do |key,value|
    p << "#{key}=#{CGI.escape(value.to_s)}"
  end
  "#{klass.path}?#{p.join('&')}"
end

.fetch(type, params = {}) ⇒ Object



23
24
25
26
27
28
# File 'lib/zillow4r.rb', line 23

def fetch(type, params = {})
  klass = get_class(type)
  path = build_path(klass, params)
  url = "http://" + WEB_API_HOST + path
  klass.new(open(url).read)
end

.method_missing(a, *args) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/zillow4r.rb', line 15

def method_missing(a, *args)
  if match = a.to_s.match(/^fetch_(.*)$/)
    self.fetch(match[1], args[0])
  else
    super(a, *args)
  end
end