zillow_demographics 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,3 @@ require "zillow_demographics/client"
3
3
  require "zillow_demographics/people"
4
4
  require "zillow_demographics/national"
5
5
 
6
- module ZillowDemographics
7
- # Your code goes here...
8
- end
@@ -24,24 +24,38 @@ module ZillowApi
24
24
  def demo_attributes(location)
25
25
  keys = parsed_response(location).search("page")[-1].search("table")[0].search("attribute").map {|key| key.child.text.downcase }
26
26
  values = parsed_response(location).search("page")[-1].search("table")[0].search("attribute").search("city").map { |values| values.child.text }
27
+ if values == []
28
+ values = %w[N/A N/A N/A N/A N/A N/A N/A]
29
+ end
27
30
  Hash[keys.zip(values)]
28
31
  end
29
32
 
30
33
  def lives_here_attributes(location)
31
34
  keys = parsed_response(location).search("page")[-1].search("liveshere").search("title").map { |value| value.text.downcase }
32
35
  values = parsed_response(location).search("page")[-1].search("liveshere").search("name").map { |key| key.text }
33
- { 'lives here' => Hash[keys.zip(values)] }
36
+ if keys == []
37
+ { 'lives here' => 'N/A'}
38
+ else
39
+ { 'lives here' => Hash[keys.zip(values)] }
40
+ end
34
41
  end
35
42
 
36
43
  def mode_of_transit(location)
37
44
  key = parsed_response(location).search("uniqueness").search("category").last.attributes['type'].value.downcase
38
45
  value = parsed_response(location).search("uniqueness").search("category").last.children.map {|s| s.text}
39
- { key => value }
46
+ if value == []
47
+ value = "N/A"
48
+ else
49
+ { key => value }
50
+ end
40
51
  end
41
52
 
42
53
  def home_value(location)
43
54
  key = parsed_response(location).search("page").first.search("data").first.search("attribute").first.child.text.downcase
44
55
  value = parsed_response(location).search("page").first.search("data").first.search("city").first.text
56
+ if value == []
57
+ value = ['N/A']
58
+ end
45
59
  { key => value }
46
60
  end
47
61
 
@@ -1,3 +1,3 @@
1
1
  module ZillowDemographics
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillow_demographics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-06-26 00:00:00.000000000 Z
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
- requirement: &70342049238340 !ruby/object:Gem::Requirement
16
+ requirement: &70131746947400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70342049238340
24
+ version_requirements: *70131746947400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70342049237720 !ruby/object:Gem::Requirement
27
+ requirement: &70131746946760 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70342049237720
35
+ version_requirements: *70131746946760
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70342049237020 !ruby/object:Gem::Requirement
38
+ requirement: &70131746945720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70342049237020
46
+ version_requirements: *70131746945720
47
47
  description: wrapper for the zillow_demographics api
48
48
  email:
49
49
  - michael.v.verdi@gmail.com