rentjuicer 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ API documentation is here: http://api.rentalapp.zillow.com/documentation/RentJui
13
13
 
14
14
  In a rails 3 app
15
15
 
16
- gem 'rentjuicer', '~> 0.9.0'
16
+ gem 'rentjuicer', '~> 0.10.1'
17
17
 
18
18
  In a rails 2.3.x app (0.6.x only)
19
19
 
@@ -10,17 +10,30 @@ module Rentjuicer
10
10
  end
11
11
  self.client = client
12
12
  end
13
-
14
- def similar_listings(limit = 6, search_options = {})
15
- search_params = {
16
- :limit => limit + 1,
17
- :min_rent => self.rent.to_i * 0.9,
18
- :max_rent => self.rent.to_i * 1.1,
13
+
14
+ def similar_listings_criteria
15
+ {
16
+ :price_low => self.rent.to_i * 0.9,
17
+ :price_high => self.rent.to_i * 1.1,
19
18
  :min_beds => ((self.bedrooms.to_i - 1) <= 0 ? 0 : (self.bedrooms.to_i - 1)),
20
19
  :max_beds => self.bedrooms.to_i + 1,
21
20
  :min_baths => ((self.bathrooms.to_i - 1) <= 0 ? 0 : (self.bathrooms.to_i - 1)),
22
21
  :max_baths => self.bathrooms.to_i + 1,
23
- :neighborhoods => self.neighborhood_name
22
+ :towns => self.neighborhood_name
23
+ }
24
+ end
25
+
26
+ def similar_listings(limit = 6, search_options = {})
27
+ criteria = similar_listings_criteria
28
+ search_params = {
29
+ :limit => limit + 1,
30
+ :min_rent => criteria[:price_low],
31
+ :max_rent => criteria[:price_high],
32
+ :min_beds => criteria[:min_beds],
33
+ :max_beds => criteria[:max_beds],
34
+ :min_baths => criteria[:min_baths],
35
+ :max_baths => criteria[:max_baths],
36
+ :neighborhoods => criteria[:towns]
24
37
  }.merge(search_options)
25
38
  @cached_similars ||= begin
26
39
  similar = []
@@ -1,3 +1,3 @@
1
1
  module Rentjuicer
2
- VERSION = '0.10.0'
2
+ VERSION = '0.10.1'
3
3
  end
@@ -44,6 +44,19 @@ describe Rentjuicer::Listing do
44
44
  it "should return an array of photos sorted by the sort_order key for sorted_photos" do
45
45
  @listing.sorted_photos.should == sorted_photos_array
46
46
  end
47
+
48
+ it "should return similar listings criteria" do
49
+ @listing.similar_listings_criteria.should ==
50
+ {
51
+ :towns=>"South Boston",
52
+ :max_beds=>4,
53
+ :price_low=>2250.0,
54
+ :min_baths=>0,
55
+ :max_baths=>2,
56
+ :price_high=>2750.0,
57
+ :min_beds=>2
58
+ }
59
+ end
47
60
 
48
61
  context "default similar listings" do
49
62
  before do
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rentjuicer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 10
9
- - 0
10
- version: 0.10.0
8
+ - 1
9
+ version: 0.10.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Tom Cocca
@@ -19,112 +18,98 @@ date: 2011-04-11 00:00:00 -04:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
23
  requirements:
25
24
  - - ~>
26
25
  - !ruby/object:Gem::Version
27
- hash: 5
28
26
  segments:
29
27
  - 3
30
28
  version: "3"
31
- requirement: *id001
32
- type: :runtime
33
29
  name: activesupport
30
+ requirement: *id001
34
31
  prerelease: false
35
32
  - !ruby/object:Gem::Dependency
33
+ type: :runtime
36
34
  version_requirements: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
35
  requirements:
39
36
  - - ~>
40
37
  - !ruby/object:Gem::Version
41
- hash: 51
42
38
  segments:
43
39
  - 0
44
40
  - 10
45
41
  - 2
46
42
  version: 0.10.2
47
- requirement: *id002
48
- type: :runtime
49
43
  name: httparty
44
+ requirement: *id002
50
45
  prerelease: false
51
46
  - !ruby/object:Gem::Dependency
47
+ type: :runtime
52
48
  version_requirements: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
49
  requirements:
55
50
  - - ~>
56
51
  - !ruby/object:Gem::Version
57
- hash: 15
58
52
  segments:
59
53
  - 0
60
54
  - 4
61
55
  - 0
62
56
  version: 0.4.0
63
- requirement: *id003
64
- type: :runtime
65
57
  name: rash
58
+ requirement: *id003
66
59
  prerelease: false
67
60
  - !ruby/object:Gem::Dependency
61
+ type: :runtime
68
62
  version_requirements: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
63
  requirements:
71
64
  - - ">="
72
65
  - !ruby/object:Gem::Version
73
- hash: 5
74
66
  segments:
75
67
  - 3
76
68
  version: "3"
77
- requirement: *id004
78
- type: :runtime
79
69
  name: will_paginate
70
+ requirement: *id004
80
71
  prerelease: false
81
72
  - !ruby/object:Gem::Dependency
73
+ type: :development
82
74
  version_requirements: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
75
  requirements:
85
76
  - - ~>
86
77
  - !ruby/object:Gem::Version
87
- hash: 63
88
78
  segments:
89
79
  - 0
90
80
  - 9
91
81
  - 2
92
82
  version: 0.9.2
93
- requirement: *id005
94
- type: :development
95
83
  name: rake
84
+ requirement: *id005
96
85
  prerelease: false
97
86
  - !ruby/object:Gem::Dependency
87
+ type: :development
98
88
  version_requirements: &id006 !ruby/object:Gem::Requirement
99
- none: false
100
89
  requirements:
101
90
  - - ">="
102
91
  - !ruby/object:Gem::Version
103
- hash: 27
104
92
  segments:
105
93
  - 2
106
94
  - 5
107
95
  - 0
108
96
  version: 2.5.0
109
- requirement: *id006
110
- type: :development
111
97
  name: rspec
98
+ requirement: *id006
112
99
  prerelease: false
113
100
  - !ruby/object:Gem::Dependency
101
+ type: :development
114
102
  version_requirements: &id007 !ruby/object:Gem::Requirement
115
- none: false
116
103
  requirements:
117
104
  - - ">="
118
105
  - !ruby/object:Gem::Version
119
- hash: 11
120
106
  segments:
121
107
  - 1
122
108
  - 6
123
109
  - 2
124
110
  version: 1.6.2
125
- requirement: *id007
126
- type: :development
127
111
  name: webmock
112
+ requirement: *id007
128
113
  prerelease: false
129
114
  description: Ruby API wrapper for rentjuice.com built with httparty
130
115
  email: tom.cocca@gmail.com
@@ -189,27 +174,23 @@ rdoc_options:
189
174
  require_paths:
190
175
  - lib
191
176
  required_ruby_version: !ruby/object:Gem::Requirement
192
- none: false
193
177
  requirements:
194
178
  - - ">="
195
179
  - !ruby/object:Gem::Version
196
- hash: 3
197
180
  segments:
198
181
  - 0
199
182
  version: "0"
200
183
  required_rubygems_version: !ruby/object:Gem::Requirement
201
- none: false
202
184
  requirements:
203
185
  - - ">="
204
186
  - !ruby/object:Gem::Version
205
- hash: 3
206
187
  segments:
207
188
  - 0
208
189
  version: "0"
209
190
  requirements: []
210
191
 
211
192
  rubyforge_project:
212
- rubygems_version: 1.4.2
193
+ rubygems_version: 1.3.6
213
194
  signing_key:
214
195
  specification_version: 3
215
196
  summary: ruby api wrapper for rentjuice