Class: Rubillow::HomeValuation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubillow/home_valuation.rb

Overview

Interface for the Home Valuation API.

Read the more about this API at: http://www.zillow.com/howto/api/HomeValuationAPIOverview.htm

Class Method Summary collapse

Class Method Details

.chart(options = {}) ⇒ Models::PropertyChart

Retrieve a chart for the specified property.

Read more at: http://www.zillow.com/howto/api/GetChart.htm.

Examples:

chart = Rubillow::HomeValuation.chart({ :zpid => '48749425', :height => '300', :width => '150' })

if chart.success?
  puts chart.to_html
end

Parameters:

  • options (Hash) (defaults to: {})

    The options for the API request.

Options Hash (options):

  • :zpid (Integer)

    The Zillow Property ID of the property. (required)

  • :unit-type (String)

    Show the percent change (“percent”), or dollar change (“dollar”). (required)

  • :width (Integer)

    The width of the image; between 200 and 600, inclusive.

  • :height (Integer)

    The height of the image; between 100 and 300, inclusive.

  • :chartDuration (Integer)

    The duration of past data to show. Valid values are “1year”, “5years” and “10years”. If unspecified, the value defaults to “1year”.

Returns:



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/rubillow/home_valuation.rb', line 90

def self.chart(options = {})
  options = {
    :zws_id => Rubillow.configuration.zwsid,
    :zpid => nil,
    :unit_type => nil,
    :width => nil,
    :height => nil,
    :chartDuration => nil,
  }.merge!(options)

  if options[:zpid].nil?
    raise ArgumentError, "The zpid option is required"
  end
  if options[:unit_type].nil?
    raise ArgumentError, "The unit_type option is required"
  end
  
  Models::PropertyChart.new(Rubillow::Request.get("GetChart", options))
end

.comps(options = {}) ⇒ Models::Comps

Retrieve a list of comps for the specified property.

Read more at: http://www.zillow.com/howto/api/GetComps.htm.

Examples:

data = Rubillow::HomeValuation.comps({ :zpid => '48749425', :count => 5 })

if data.success?
  puts data.principal.price  # "1032000"
  data.comparables.each do |comp|
    puts comparables.price
  end
end

Parameters:

  • options (Hash) (defaults to: {})

    The options for the API request.

Options Hash (options):

  • :zpid (Integer)

    The Zillow Property ID of the property. (required)

  • :count (Integer)

    The number of comps to return, between 1 and 25 inclusive. (required)

  • :rentzestimate (Boolean)

    Return Rent Zestimate information if available. Default: false

Returns:



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/rubillow/home_valuation.rb', line 129

def self.comps(options = {})
  options = {
    :zws_id => Rubillow.configuration.zwsid,
    :zpid => nil,
    :count => nil,
    :rentzestimate => false,
  }.merge!(options)

  if options[:zpid].nil?
    raise ArgumentError, "The zpid option is required"
  end
  if options[:count].nil?
    raise ArgumentError, "The count option is required"
  end
  
  Models::Comps.new(Rubillow::Request.get("GetComps", options))
end

.search_results(options = {}) ⇒ Models::SearchResult

Retrieve a property by the specified address.

Read more at: http://www.zillow.com/howto/api/GetSearchResults.htm.

Examples:

data = Rubillow::HomeValuation.search_results({ :address => '2114 Bigelow Ave', :citystatezip => 'Seattle, WA' })

if data.success?
  puts data.zpid    # "48749425" 
  puts data.price   # "1032000"
end

Parameters:

  • options (Hash) (defaults to: {})

    The options for the API request.

Options Hash (options):

  • :address (String)

    The address of the property to search. (required)

  • :citystatezip (String)

    The city+state combination and/or ZIP code for which to search. Note that giving both city and state is required. Using just one will not work. (required)

  • :rentzestimate (Boolean)

    Return Rent Zestimate information if available. Default: false

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rubillow/home_valuation.rb', line 23

def self.search_results(options = {})
  options = {
    :zws_id => Rubillow.configuration.zwsid,
    :address => nil,
    :citystatezip => nil,
    :rentzestimate => false,
  }.merge!(options)

  if options[:address].nil?
    raise ArgumentError, "The address option is required"
  end
  if options[:citystatezip].nil?
    raise ArgumentError, "The citystatezip option is required"
  end

  Models::SearchResult.new(Rubillow::Request.get("GetSearchResults", options))
end

.zestimate(options = {}) ⇒ Models::SearchResult

Retrieve a zestimate for the specified property.

Read more at: http://www.zillow.com/howto/api/GetZestimate.htm.

Examples:

data = Rubillow::HomeValuation.zestimate({ :zpid => '48749425' })

if data.success?
  puts data.zpid          # "48749425" 
  puts data.price         # "1032000"
  puts data.value_change  # "5900"
end

Parameters:

  • options (Hash) (defaults to: {})

    The options for the API request.

Options Hash (options):

  • :zpid (Integer)

    The Zillow Property ID of the property. (required)

  • :rentzestimate (Boolean)

    Return Rent Zestimate information if available. Default: false

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rubillow/home_valuation.rb', line 58

def self.zestimate(options = {})
  options = {
    :zws_id => Rubillow.configuration.zwsid,
    :zpid => nil,
    :rentzestimate => false,
  }.merge!(options)
  
  if options[:zpid].nil?
    raise ArgumentError, "The zpid option is required"
  end
  
  Models::SearchResult.new(Rubillow::Request.get("GetZestimate", options))
end