you_got_listed 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -15,7 +15,7 @@ YouGotListings API documentation can be found here: http://www.yougotlistings.co
15
15
 
16
16
  In a rails 3 app
17
17
 
18
- gem 'you_got_listed', '~> 0.5.1'
18
+ gem 'you_got_listed', '~> 0.6.1'
19
19
 
20
20
  In a rails 2.3.x app (0.2.x only)
21
21
 
@@ -12,21 +12,28 @@ module YouGotListed
12
12
  end
13
13
  self.client = client
14
14
  end
15
+
16
+ def similar_listings_criteria
17
+ {
18
+ :price_low => (self.price.to_i * 0.9).to_i,
19
+ :price_high => (self.price.to_i * 1.1).to_i,
20
+ :min_beds => ((self.beds.to_i - 1) <= 0 ? 0 : (self.beds.to_i - 1)),
21
+ :max_beds => self.beds.to_i + 1,
22
+ :min_baths => ((self.baths.to_i - 1) <= 0 ? 0 : (self.baths.to_i - 1)),
23
+ :max_baths => self.baths.to_i + 1,
24
+ :towns => self.city_neighborhood
25
+ }
26
+ end
15
27
 
16
28
  def similar_listings(limit = 6, search_options = {})
17
- min_baths = ((self.baths.to_i - 1) <= 0 ? 0 : (self.baths.to_i - 1))
18
- max_baths = self.baths.to_i + 1
19
- min_rent = (self.price.to_i * 0.9).to_i
20
- max_rent = (self.price.to_i * 1.1).to_i
21
- min_beds = ((self.beds.to_i - 1) <= 0 ? 0 : (self.beds.to_i - 1))
22
- max_beds = self.beds.to_i + 1
29
+ criteria = similar_listings_criteria
23
30
  search_params = {
24
31
  :limit => limit + 1,
25
- :min_rent => min_rent,
26
- :max_rent => max_rent,
27
- :min_bed => min_beds,
28
- :max_bed => max_beds,
29
- :baths => [min_baths, self.baths, max_baths].join(','),
32
+ :min_rent => criteria[:price_low],
33
+ :max_rent => criteria[:price_high],
34
+ :min_bed => criteria[:min_beds],
35
+ :max_bed => criteria[:max_beds],
36
+ :baths => [criteria[:min_baths], self.baths, criteria[:max_baths]].join(','),
30
37
  :city_neighborhood => self.city_neighborhood
31
38
  }.merge(search_options)
32
39
  @cached_similars ||= begin
@@ -1,3 +1,3 @@
1
1
  module YouGotListed
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -32,6 +32,19 @@ describe YouGotListed::Listing do
32
32
  it "should return photos for pictures" do
33
33
  @listing.pictures.should == @listing.photos.photo
34
34
  end
35
+
36
+ it "should return similar listings criteria" do
37
+ @listing.similar_listings_criteria.should ==
38
+ {
39
+ :towns=>"Boston:Fenway",
40
+ :min_baths=>0,
41
+ :min_beds=>0,
42
+ :max_baths=>2,
43
+ :max_beds=>1,
44
+ :price_low=>720,
45
+ :price_high=>880
46
+ }
47
+ end
35
48
 
36
49
  context "default similar listings" do
37
50
  before do
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: you_got_listed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 6
9
- - 0
10
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Tom Cocca
@@ -19,128 +18,112 @@ 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
  - !ruby/object:Gem::Dependency
115
+ type: :development
130
116
  version_requirements: &id008 !ruby/object:Gem::Requirement
131
- none: false
132
117
  requirements:
133
118
  - - ">="
134
119
  - !ruby/object:Gem::Version
135
- hash: 55
136
120
  segments:
137
121
  - 1
138
122
  - 8
139
123
  - 0
140
124
  version: 1.8.0
141
- requirement: *id008
142
- type: :development
143
125
  name: vcr
126
+ requirement: *id008
144
127
  prerelease: false
145
128
  description: Ruby API wrapper for yougotlistings.com built with httparty
146
129
  email: tom.cocca@gmail.com
@@ -201,27 +184,23 @@ rdoc_options:
201
184
  require_paths:
202
185
  - lib
203
186
  required_ruby_version: !ruby/object:Gem::Requirement
204
- none: false
205
187
  requirements:
206
188
  - - ">="
207
189
  - !ruby/object:Gem::Version
208
- hash: 3
209
190
  segments:
210
191
  - 0
211
192
  version: "0"
212
193
  required_rubygems_version: !ruby/object:Gem::Requirement
213
- none: false
214
194
  requirements:
215
195
  - - ">="
216
196
  - !ruby/object:Gem::Version
217
- hash: 3
218
197
  segments:
219
198
  - 0
220
199
  version: "0"
221
200
  requirements: []
222
201
 
223
202
  rubyforge_project:
224
- rubygems_version: 1.4.2
203
+ rubygems_version: 1.3.6
225
204
  signing_key:
226
205
  specification_version: 3
227
206
  summary: ruby api wrapper for you got listings