rentjuicer 0.6.1 → 0.6.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -32,7 +32,7 @@ module Rentjuicer
32
32
  response = search(params)
33
33
  if response.success?
34
34
  all_listings << response.properties
35
- total_pages = (response.body.total_count/per_page.to_f).ceil
35
+ total_pages = (response.total_results/per_page.to_f).ceil
36
36
  if total_pages > 1
37
37
  (2..total_pages).each do |page_num|
38
38
  resp = search(params.merge(:page => page_num))
@@ -75,6 +75,10 @@ module Rentjuicer
75
75
  end
76
76
  end
77
77
 
78
+ def total_results
79
+ self.body.total_count ? self.body.total_count : properties.size
80
+ end
81
+
78
82
  def mls_results?
79
83
  @has_mls_properties ||= properties.any?{|property| property.mls_listing?}
80
84
  end
@@ -88,7 +92,7 @@ module Rentjuicer
88
92
  self.paginator_cache = WillPaginate::Collection.create(
89
93
  self.body.page ||= 1,
90
94
  @limit,
91
- (self.body.total_count ? self.body.total_count : properties.size)) do |pager|
95
+ self.total_results) do |pager|
92
96
  pager.replace properties
93
97
  end
94
98
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rentjuicer}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tcocca"]
@@ -65,6 +65,11 @@ describe Rentjuicer::Response do
65
65
  @results.body = body
66
66
  @results.total_count.should == 25
67
67
  end
68
+
69
+ it "should return @properties.size when total_count is nil for total_results" do
70
+ @results.body.stub!(:total_count).and_return(nil)
71
+ @results.total_results.should == 20
72
+ end
68
73
 
69
74
  it "should call super if body does not response to the method" do
70
75
  lambda { @results.bad_method }.should raise_error(NoMethodError, /undefined method `bad_method'/)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rentjuicer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - tcocca