zillower 0.0.0.alpha1 → 0.0.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/lib/zillower.rb +6 -24
- data/lib/zillower/base.rb +7 -0
- data/lib/zillower/full_address.rb +5 -0
- data/lib/zillower/home_valuation.rb +47 -0
- data/lib/zillower/version.rb +18 -0
- data/lib/zillower/zestimate.rb +4 -2
- metadata +45 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5651c63fa4f0cf35ff69ae28a3802ea0842dfda
|
4
|
+
data.tar.gz: f5f05fe5a12424dfee33e4045f58a7f650cce383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a39cb0519391e68f498455821e8d4b7e2e651e29b83b636272fd659e33551a453f3f2a30fc3c3b431b4c0b672ea1a96c9db1b1e1e913a1472d94d7e0f0cb0b
|
7
|
+
data.tar.gz: 52608761b00f5bf0967526818597e5e2a03982abed21312bf120d64572b7242ea4a2ab61a1c8e60112a68dd282dea6f2b20783ea8360e20344527efddbee11f6
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright © Dmitrii Sosedov 2015
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/lib/zillower.rb
CHANGED
@@ -1,26 +1,8 @@
|
|
1
|
-
require "
|
2
|
-
require "
|
1
|
+
require "zillower/base"
|
2
|
+
require "zillower/full_address"
|
3
|
+
require "zillower/home_valuation"
|
4
|
+
require "zillower/version"
|
5
|
+
require "zillower/zestimate"
|
3
6
|
|
4
|
-
|
5
|
-
|
6
|
-
class Zillower
|
7
|
-
@@get_zestimate_uri = "http://www.zillow.com/webservice/GetZestimate.htm"
|
8
|
-
|
9
|
-
def initialize(zwsid)
|
10
|
-
@zwsid = zwsid
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_zestimate(zpid)
|
14
|
-
uri = URI(@@get_zestimate_uri)
|
15
|
-
|
16
|
-
uri.query = URI.encode_www_form({ "zws-id" => @zwsid, :zpid => zpid })
|
17
|
-
|
18
|
-
xml = Nokogiri::XML(Net::HTTP.get_response(uri).body)
|
19
|
-
|
20
|
-
zestimate = Zestimate.new
|
21
|
-
|
22
|
-
zestimate.amount = xml.xpath("//zestimate/amount").children[0].text.to_i
|
23
|
-
|
24
|
-
zestimate
|
25
|
-
end
|
7
|
+
module Zillower
|
26
8
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "nokogiri"
|
3
|
+
|
4
|
+
require "zillower/base"
|
5
|
+
|
6
|
+
module Zillower
|
7
|
+
class HomeValuation
|
8
|
+
attr_accessor :zpid, :full_address, :zestimate
|
9
|
+
|
10
|
+
def self.get_search_results(zwsid, address, citystatezip, rent_zestimate = false)
|
11
|
+
get "GetSearchResults.htm", { "zws-id" => zwsid, "address" => address, "citystatezip" => citystatezip, "rentzestimate" => rent_zestimate }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_zestimate(zwsid, zpid, rent_zestimate = false)
|
15
|
+
get "GetZestimate.htm", { "zws-id" => zwsid, "zpid" => zpid, "rentzestimate" => rent_zestimate }
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def self.get(relative_url, params)
|
20
|
+
uri = URI("#{Zillower::Base.base_url}/#{relative_url}")
|
21
|
+
|
22
|
+
uri.query = URI.encode_www_form(params)
|
23
|
+
|
24
|
+
prepare_result(Nokogiri::XML(Net::HTTP.get_response(uri).body))
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.prepare_result(xml)
|
28
|
+
begin
|
29
|
+
home_valuation = HomeValuation.new
|
30
|
+
home_valuation.zpid = xml.xpath("//zpid").children[0].text
|
31
|
+
home_valuation.full_address = FullAddress.new
|
32
|
+
home_valuation.full_address.street_address = xml.xpath("//address/street").text
|
33
|
+
home_valuation.full_address.zip_code = xml.xpath("//address/zipcode").text
|
34
|
+
home_valuation.full_address.city = xml.xpath("//address/city").text
|
35
|
+
home_valuation.full_address.state = xml.xpath("//address/state").text
|
36
|
+
home_valuation.full_address.latitude = xml.xpath("//address/latitude").text
|
37
|
+
home_valuation.full_address.longitude = xml.xpath("//address/longitude").text
|
38
|
+
home_valuation.zestimate = Zestimate.new
|
39
|
+
home_valuation.zestimate.amount = xml.xpath("//zestimate/amount").children[0].text.to_i
|
40
|
+
|
41
|
+
home_valuation
|
42
|
+
rescue
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Zillower
|
2
|
+
module Version
|
3
|
+
MAJOR = 0
|
4
|
+
MINOR = 0
|
5
|
+
PATCH = 0
|
6
|
+
PRE = "beta"
|
7
|
+
|
8
|
+
def self.display_version
|
9
|
+
"#{MAJOR}.#{MINOR}.#{PATCH}-#{PRE}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.gem_version
|
13
|
+
pre = PRE.gsub(".", "")
|
14
|
+
|
15
|
+
"#{MAJOR}.#{MINOR}.#{PATCH}.#{pre}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/zillower/zestimate.rb
CHANGED
metadata
CHANGED
@@ -1,36 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zillower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitrii Sosedov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: codeclimate-test-reporter
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- - "
|
31
|
+
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
33
|
version: '0'
|
20
|
-
type: :
|
34
|
+
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- - "
|
38
|
+
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
description: Yet another Zillow API wrapper. It has been started for my personal need
|
56
|
+
to get one data point from Zillow. But the plan is to make it evolve into something
|
57
|
+
that will bring value to the others.
|
28
58
|
email: d.sosedov@gmail.com
|
29
59
|
executables: []
|
30
60
|
extensions: []
|
31
61
|
extra_rdoc_files: []
|
32
62
|
files:
|
63
|
+
- LICENSE
|
33
64
|
- lib/zillower.rb
|
65
|
+
- lib/zillower/base.rb
|
66
|
+
- lib/zillower/full_address.rb
|
67
|
+
- lib/zillower/home_valuation.rb
|
68
|
+
- lib/zillower/version.rb
|
34
69
|
- lib/zillower/zestimate.rb
|
35
70
|
homepage: http://rubygems.org/gems/zillower
|
36
71
|
licenses:
|
@@ -44,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
79
|
requirements:
|
45
80
|
- - ">="
|
46
81
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
82
|
+
version: 1.9.2
|
48
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
84
|
requirements:
|
50
85
|
- - ">"
|
@@ -52,8 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
87
|
version: 1.3.1
|
53
88
|
requirements: []
|
54
89
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.4.
|
90
|
+
rubygems_version: 2.4.7
|
56
91
|
signing_key:
|
57
92
|
specification_version: 4
|
58
|
-
summary:
|
93
|
+
summary: A Zillow API wrapper
|
59
94
|
test_files: []
|