rubillow 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 CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  .bundle
3
+ .rvmrc
3
4
  pkg/*
4
5
  coverage
5
6
  doc
data/.yardopts CHANGED
@@ -1,4 +1,5 @@
1
1
  --no-private
2
2
  lib/**/*.rb
3
3
  -
4
- LICENSE
4
+ LICENSE
5
+ CHANGELOG.md
data/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ ## 0.0.5 / 2013-01-12
2
+
3
+ * Include RentZestimate if available
4
+ * Check if region info exists before populating
5
+
6
+ ## 0.0.4 / 2012-01-31
7
+
8
+ * Check if lastSoldDate exists before parsing
9
+
10
+ ## 0.0.3 / 2012-01-14
11
+
12
+ * Fix GetUpdatedPropertyDetails date requirement
13
+ * Fix typo on method name
14
+ * Updated documentation
15
+ * Added Travis CI and dependency tracking
16
+ * Remove unnecessary testing dependencies
17
+
18
+ ## 0.0.2 / 2011-09-27
19
+
20
+ * Remove unnecessary dependencies of activesupport and i18n
21
+
22
+ ## 0.0.1 / 2011-08-27
23
+
24
+ * Covers all Zillow API endpoints
25
+ * Code documentation
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubillow (0.0.3)
4
+ rubillow (0.0.5)
5
5
  nokogiri (~> 1.5.0)
6
6
 
7
7
  GEM
@@ -9,7 +9,7 @@ GEM
9
9
  specs:
10
10
  bluecloth (2.1.0)
11
11
  diff-lcs (1.1.2)
12
- nokogiri (1.5.0)
12
+ nokogiri (1.5.6)
13
13
  rake (0.9.2)
14
14
  rcov (0.9.10)
15
15
  rspec (2.6.0)
data/README.md CHANGED
@@ -61,7 +61,7 @@ You should find the documentation for your version of Rubillow on [Rubygems](htt
61
61
 
62
62
  # Build & Dependency Status
63
63
 
64
- [![Build Status](http://travis-ci.org/synewaves/rubillow.png)](http://travis-ci.org/synewaves/rubillow)
64
+ [![Build Status](https://travis-ci.org/synewaves/rubillow.png?branch=master)](https://travis-ci.org/synewaves/rubillow)
65
65
  [![Dependency Status](https://gemnasium.com/synewaves/rubillow.png?travis)](https://gemnasium.com/synewaves/rubillow)
66
66
 
67
67
  # License
@@ -16,14 +16,16 @@ module Rubillow
16
16
  # end
17
17
  #
18
18
  # @param [Hash] options The options for the API request.
19
- # @option options [String] :address The address of the property to search. (required)
20
- # @option options [String] :citystatezip 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)
19
+ # @option options [String] :address The address of the property to search. (required)
20
+ # @option options [String] :citystatezip 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)
21
+ # @option options [Boolean] :rentzestimate Return Rent Zestimate information if available. Default: false
21
22
  # @return [Models::SearchResult] Property information.
22
23
  def self.search_results(options = {})
23
24
  options = {
24
25
  :zws_id => Rubillow.configuration.zwsid,
25
26
  :address => nil,
26
27
  :citystatezip => nil,
28
+ :rentzestimate => false,
27
29
  }.merge!(options)
28
30
 
29
31
  if options[:address].nil?
@@ -50,12 +52,14 @@ module Rubillow
50
52
  # end
51
53
  #
52
54
  # @param [Hash] options The options for the API request.
53
- # @option options [Integer] :zpid The Zillow Property ID of the property. (required)
55
+ # @option options [Integer] :zpid The Zillow Property ID of the property. (required)
56
+ # @option options [Boolean] :rentzestimate Return Rent Zestimate information if available. Default: false
54
57
  # @return [Models::SearchResult] Property pricing information.
55
58
  def self.zestimate(options = {})
56
59
  options = {
57
60
  :zws_id => Rubillow.configuration.zwsid,
58
61
  :zpid => nil,
62
+ :rentzestimate => false,
59
63
  }.merge!(options)
60
64
 
61
65
  if options[:zpid].nil?
@@ -118,14 +122,16 @@ module Rubillow
118
122
  # end
119
123
  #
120
124
  # @param [Hash] options The options for the API request.
121
- # @option options [Integer] :zpid The Zillow Property ID of the property. (required)
122
- # @option options [Integer] :count The number of comps to return, between 1 and 25 inclusive. (required)
125
+ # @option options [Integer] :zpid The Zillow Property ID of the property. (required)
126
+ # @option options [Integer] :count The number of comps to return, between 1 and 25 inclusive. (required)
127
+ # @option options [Boolean] :rentzestimate Return Rent Zestimate information if available. Default: false
123
128
  # @return [Models::Comps] Comps Property information and comps list.
124
129
  def self.comps(options = {})
125
130
  options = {
126
131
  :zws_id => Rubillow.configuration.zwsid,
127
132
  :zpid => nil,
128
133
  :count => nil,
134
+ :rentzestimate => false,
129
135
  }.merge!(options)
130
136
 
131
137
  if options[:zpid].nil?
@@ -43,6 +43,9 @@ module Rubillow
43
43
 
44
44
  # @return [String] region type
45
45
  attr_accessor :region_type
46
+
47
+ # @return [Hash] Rent Zestimate information (keys: :price, :last_updated, :value_change, :value_duration, :valuation_range => { :low, :high }, :percentile)
48
+ attr_accessor :rent_zestimate
46
49
 
47
50
  protected
48
51
 
@@ -59,20 +62,39 @@ module Rubillow
59
62
  :high => xml.xpath('//zestimate/valuationRange/high').text,
60
63
  }
61
64
  @change = xml.xpath('//zestimate/valueChange').text
65
+
66
+ if xml.xpath('//rentzestimate/amount').text.length > 0
67
+ @rent_zestimate = {
68
+ :price => xml.xpath('//rentzestimate/amount').text,
69
+ :last_updated => xml.xpath('//rentzestimate/last-updated').text,
70
+ :value_change => xml.xpath('//rentzestimate/valueChange').text,
71
+ :value_duration => xml.xpath('//rentzestimate/valueChange').attr('duration').value,
72
+ :valuation_range => {
73
+ :low => xml.xpath('//rentzestimate/valuationRange/low').text,
74
+ :high => xml.xpath('//rentzestimate/valuationRange/high').text
75
+ },
76
+ :percentile => xml.xpath('//rentzestimate/percentile').text
77
+ }
78
+ else
79
+ @rent_zestimate = {}
80
+ end
81
+
62
82
  if tmp = xml.xpath('//zestimate/valueChange').attr('duration')
63
83
  @change_duration = tmp.value
64
84
  end
65
85
  @percentile = xml.xpath('//zestimate/percentile').text
66
-
67
- @region = xml.xpath('//localRealEstate/region').attribute('name').value
68
- @region_id = xml.xpath('//localRealEstate/region').attribute('id').value
69
- @region_type = xml.xpath('//localRealEstate/region').attribute('type').value
70
-
71
- @local_real_estate = {
72
- :overview => xml.xpath('//localRealEstate/region/links/overview').text,
73
- :for_sale_by_owner => xml.xpath('//localRealEstate/region/links/forSaleByOwner').text,
74
- :for_sale => xml.xpath('//localRealEstate/region/links/forSale').text,
75
- }
86
+
87
+ if xml.at_xpath('//localRealEstate/region')
88
+ @region = xml.xpath('//localRealEstate/region').attribute('name').value
89
+ @region_id = xml.xpath('//localRealEstate/region').attribute('id').value
90
+ @region_type = xml.xpath('//localRealEstate/region').attribute('type').value
91
+
92
+ @local_real_estate = {
93
+ :overview => xml.xpath('//localRealEstate/region/links/overview').text,
94
+ :for_sale_by_owner => xml.xpath('//localRealEstate/region/links/forSaleByOwner').text,
95
+ :for_sale => xml.xpath('//localRealEstate/region/links/forSale').text,
96
+ }
97
+ end
76
98
  end
77
99
  end
78
100
  end
@@ -17,14 +17,16 @@ module Rubillow
17
17
  # end
18
18
  #
19
19
  # @param [Hash] options The options for the API request.
20
- # @option options [String] :address The address of the property to search. (required)
21
- # @option options [String] :citystatezip 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)
20
+ # @option options [String] :address The address of the property to search. (required)
21
+ # @option options [String] :citystatezip 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)
22
+ # @option options [Boolean] :rentzestimate Return Rent Zestimate information if available. Default: false
22
23
  # @return [Models::DeepSearchResult] Extended property details.
23
24
  def self.deep_search_results(options = {})
24
25
  options = {
25
26
  :zws_id => Rubillow.configuration.zwsid,
26
27
  :address => nil,
27
28
  :citystatezip => nil,
29
+ :rentzestimate => false,
28
30
  }.merge!(options)
29
31
 
30
32
  if options[:address].nil?
@@ -53,14 +55,16 @@ module Rubillow
53
55
  # end
54
56
  #
55
57
  # @param [Hash] options The options for the API request.
56
- # @option options [Integer] :zpid The Zillow Property ID of the property. (required)
57
- # @option options [Integer] :count The number of comps to return, between 1 and 25 inclusive. (required)
58
+ # @option options [Integer] :zpid The Zillow Property ID of the property. (required)
59
+ # @option options [Integer] :count The number of comps to return, between 1 and 25 inclusive. (required)
60
+ # @option options [Boolean] :rentzestimate Return Rent Zestimate information if available. Default: false
58
61
  # @return [Models::DeepComps] Extended property and comp details.
59
62
  def self.deep_comps(options = {})
60
63
  options = {
61
64
  :zws_id => Rubillow.configuration.zwsid,
62
65
  :zpid => nil,
63
66
  :count => nil,
67
+ :rentzestimate => false,
64
68
  }.merge!(options)
65
69
 
66
70
  if options[:zpid].nil?
@@ -1,4 +1,4 @@
1
1
  module Rubillow
2
2
  # @private
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
@@ -64,5 +64,37 @@ describe Rubillow::Models::SearchResult do
64
64
  data.region.should == "East Queen Anne"
65
65
  data.region_type.should == "neighborhood"
66
66
  data.region_id.should == "271856"
67
+ data.rent_zestimate[:price].should == "3379"
68
+ data.rent_zestimate[:last_updated].should == "12/17/2012"
69
+ data.rent_zestimate[:value_change].should == "107"
70
+ data.rent_zestimate[:value_duration].should == "30"
71
+ data.rent_zestimate[:valuation_range][:low].should == "2154"
72
+ data.rent_zestimate[:valuation_range][:high].should == "5102"
67
73
  end
68
- end
74
+
75
+ it "populates the results from GetZestimate with missing region data" do
76
+ data = Rubillow::Models::SearchResult.new(get_xml('get_zestimate_missing_region.xml'))
77
+
78
+ data.zpid.should == '78264249'
79
+ data.links.count.should == 4
80
+ data.links[:homedetails].should == "http://www.zillow.com/homedetails/8663-Orchard-Loop-Rd-NE-Leland-NC-28451/78264249_zpid/"
81
+ data.links[:graphsanddata].should == "http://www.zillow.com/homedetails/8663-Orchard-Loop-Rd-NE-Leland-NC-28451/78264249_zpid/#charts-and-data"
82
+ data.links[:mapthishome].should == "http://www.zillow.com/homes/78264249_zpid/"
83
+ data.links[:comparables].should == "http://www.zillow.com/homes/comps/78264249_zpid/"
84
+ data.address[:street].should == "8663 Orchard Loop Rd NE"
85
+ data.address[:city].should == "Leland"
86
+ data.address[:state].should == "NC"
87
+ data.address[:zipcode].should == "28451"
88
+ data.address[:latitude].should == "34.217408"
89
+ data.address[:longitude].should == "-78.054412"
90
+ data.price.should == "136518"
91
+ data.percentile.should == "58"
92
+ data.last_updated.strftime("%m/%d/%Y").should == "12/27/2012"
93
+ data.valuation_range[:low].should == "23208"
94
+ data.valuation_range[:high].should == "203412"
95
+ data.change.should == "-1299"
96
+ data.change_duration.should == "30"
97
+ data.local_real_estate.should == nil
98
+ data.region.should == nil
99
+ end
100
+ end
@@ -14,10 +14,17 @@ RSpec::Matchers.define :have_configuration_option do |option|
14
14
  @default = default
15
15
  end
16
16
 
17
- failure_message do
17
+ failure_message_for_should do
18
18
  description = "expected #{subject} to have"
19
19
  description << " configuration option #{option.inspect}"
20
20
  description << " with a default of #{@default.inspect}" if instance_variables.include?("@default")
21
21
  description
22
22
  end
23
+
24
+ failure_message_for_should_not do
25
+ description = "expected #{subject} to not have"
26
+ description << " configuration option #{option.inspect}"
27
+ description << " with a default of #{@default.inspect}" if instance_variables.include?("@default")
28
+ description
29
+ end
23
30
  end
@@ -36,6 +36,16 @@
36
36
  </valuationRange>
37
37
  <percentile>95</percentile>
38
38
  </zestimate>
39
+ <rentzestimate>
40
+ <amount currency="USD">3379</amount>
41
+ <last-updated>12/17/2012</last-updated>
42
+ <oneWeekChange deprecated="true"></oneWeekChange>
43
+ <valueChange duration="30" currency="USD">107</valueChange>
44
+ <valuationRange>
45
+ <low currency="USD">2154</low>
46
+ <high currency="USD">5102</high>
47
+ </valuationRange>
48
+ </rentzestimate>
39
49
  <localRealEstate>
40
50
  <region id="271856" type="neighborhood" name="East Queen Anne">
41
51
  <links>
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Zestimate:zestimate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Zestimate="http://www.zillow.com/static/xsd/Zestimate.xsd" xsi:schemaLocation="http://www.zillow.com/static/xsd/Zestimate.xsd http://www.zillowstatic.com/vstatic/4f6d65a3e1e76db2baf166972ee9ef71/static/xsd/Zestimate.xsd">
3
+ <request>
4
+ <zpid>78264249</zpid>
5
+ </request>
6
+ <message>
7
+ <text>Request successfully processed</text>
8
+ <code>0</code>
9
+ </message>
10
+ <response>
11
+ <zpid>78264249</zpid>
12
+ <links>
13
+ <homedetails>http://www.zillow.com/homedetails/8663-Orchard-Loop-Rd-NE-Leland-NC-28451/78264249_zpid/</homedetails>
14
+ <graphsanddata>http://www.zillow.com/homedetails/8663-Orchard-Loop-Rd-NE-Leland-NC-28451/78264249_zpid/#charts-and-data</graphsanddata>
15
+ <mapthishome>http://www.zillow.com/homes/78264249_zpid/</mapthishome>
16
+ <comparables>http://www.zillow.com/homes/comps/78264249_zpid/</comparables>
17
+ </links>
18
+ <address>
19
+ <street>8663 Orchard Loop Rd NE</street>
20
+ <zipcode>28451</zipcode>
21
+ <city>Leland</city>
22
+ <state>NC</state>
23
+ <latitude>34.217408</latitude>
24
+ <longitude>-78.054412</longitude>
25
+ </address>
26
+ <zestimate>
27
+ <amount currency="USD">136518</amount>
28
+ <last-updated>12/27/2012</last-updated>
29
+ <oneWeekChange deprecated="true"></oneWeekChange>
30
+ <valueChange duration="30" currency="USD">-1299</valueChange>
31
+ <valuationRange>
32
+ <low currency="USD">23208</low>
33
+ <high currency="USD">203412</high>
34
+ </valuationRange>
35
+ <percentile>58</percentile>
36
+ </zestimate>
37
+ <localRealEstate></localRealEstate>
38
+ <regions>
39
+ <zipcode-id>69961</zipcode-id>
40
+ <city-id></city-id>
41
+ <county-id>2640</county-id>
42
+ <state-id>36</state-id>
43
+ </regions>
44
+ </response>
45
+ </Zestimate:zestimate>
46
+ <!-- H:001 T:15ms S:790 R:Fri Dec 28 20:59:48 PST 2012 B:3.0.177752.20121228113358693comp_rel_a.177752.20121228113743311comp_rel_a -->
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubillow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
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-01-31 00:00:00.000000000 Z
12
+ date: 2013-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70347482059400 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.9.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70347482059400
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.2
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70347482058600 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '2.6'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70347482058600
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.6'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: yard
38
- requirement: &70347482057600 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 0.6.8
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70347482057600
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.8
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: bluecloth
49
- requirement: &70347482056820 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 2.1.0
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70347482056820
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.1.0
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rcov
60
- requirement: &70347482056320 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.9.10
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70347482056320
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.10
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: nokogiri
71
- requirement: &70347482055860 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,7 +101,12 @@ dependencies:
76
101
  version: 1.5.0
77
102
  type: :runtime
78
103
  prerelease: false
79
- version_requirements: *70347482055860
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.5.0
80
110
  description: Ruby library to access the Zillow API
81
111
  email:
82
112
  - rubillow@matthewvince.com
@@ -88,6 +118,7 @@ files:
88
118
  - .rspec
89
119
  - .travis.yml
90
120
  - .yardopts
121
+ - CHANGELOG.md
91
122
  - Gemfile
92
123
  - Gemfile.lock
93
124
  - LICENSE
@@ -164,6 +195,7 @@ files:
164
195
  - spec/xml/get_search_results.xml
165
196
  - spec/xml/get_updated_property_details.xml
166
197
  - spec/xml/get_zestimate.xml
198
+ - spec/xml/get_zestimate_missing_region.xml
167
199
  - spec/xml/near_limit.xml
168
200
  homepage: https://github.com/synewaves/rubillow
169
201
  licenses: []
@@ -185,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
217
  version: '0'
186
218
  requirements: []
187
219
  rubyforge_project: rubillow
188
- rubygems_version: 1.8.10
220
+ rubygems_version: 1.8.23
189
221
  signing_key:
190
222
  specification_version: 3
191
223
  summary: Ruby library to access the Zillow API
@@ -228,4 +260,6 @@ test_files:
228
260
  - spec/xml/get_search_results.xml
229
261
  - spec/xml/get_updated_property_details.xml
230
262
  - spec/xml/get_zestimate.xml
263
+ - spec/xml/get_zestimate_missing_region.xml
231
264
  - spec/xml/near_limit.xml
265
+ has_rdoc: