you_got_listed 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,18 +12,21 @@ module YouGotListed
12
12
  end
13
13
 
14
14
  def properties
15
- return [] if self.listings.blank?
16
- props = []
17
- if self.listings.listing.is_a?(Array)
18
- self.listings.listing.each do |listing|
19
- listing = listing.merge(find_address(listing.address_id))
20
- props << YouGotListed::Listing.new(listing, self.client)
15
+ @cached_properties ||= begin
16
+ props = []
17
+ unless self.listings.blank?
18
+ if self.listings.listing.is_a?(Array)
19
+ self.listings.listing.each do |listing|
20
+ listing = listing.merge(find_address(listing.address_id))
21
+ props << YouGotListed::Listing.new(listing, self.client)
22
+ end
23
+ else
24
+ listing = self.listings.listing.merge(find_address(listing.address_id))
25
+ props << YouGotListed::Listing.new(listing, self.client)
26
+ end
21
27
  end
22
- else
23
- listing = self.listings.listing.merge(find_address(listing.address_id))
24
- props << YouGotListed::Listing.new(listing, self.client)
28
+ props
25
29
  end
26
- props
27
30
  end
28
31
 
29
32
  def pictures
@@ -26,16 +26,19 @@ module YouGotListed
26
26
  end
27
27
 
28
28
  def property_complexes
29
- return [] if self.ygl_response.complexes.blank?
30
- props = []
31
- if self.ygl_response.complexes.complex.is_a?(Array)
32
- self.ygl_response.complexes.complex.each do |complex|
33
- props << YouGotListed::Complex.new(complex, self.client)
29
+ @cached_property_complexes ||= begin
30
+ props = []
31
+ if self.success? && !self.ygl_response.complexes.blank?
32
+ if self.ygl_response.complexes.complex.is_a?(Array)
33
+ self.ygl_response.complexes.complex.each do |complex|
34
+ props << YouGotListed::Complex.new(complex, self.client)
35
+ end
36
+ else
37
+ props << YouGotListed::Complex.new(self.ygl_response.complexes.complex, self.client)
38
+ end
34
39
  end
35
- else
36
- props << YouGotListed::Complex.new(self.ygl_response.complexes.complex, self.client)
40
+ props
37
41
  end
38
- props
39
42
  end
40
43
 
41
44
  def paginator
@@ -73,16 +73,19 @@ module YouGotListed
73
73
  end
74
74
 
75
75
  def properties
76
- return [] if !self.success? || self.ygl_response.listings.blank?
77
- props = []
78
- if self.ygl_response.listings.listing.is_a?(Array)
79
- self.ygl_response.listings.listing.each do |listing|
80
- props << YouGotListed::Listing.new(listing, self.client)
76
+ @cached_properties ||= begin
77
+ props = []
78
+ if self.success? && !self.ygl_response.listings.blank?
79
+ if self.ygl_response.listings.listing.is_a?(Array)
80
+ self.ygl_response.listings.listing.each do |listing|
81
+ props << YouGotListed::Listing.new(listing, self.client)
82
+ end
83
+ else
84
+ props << YouGotListed::Listing.new(self.ygl_response.listings.listing, self.client)
85
+ end
81
86
  end
82
- else
83
- props << YouGotListed::Listing.new(self.ygl_response.listings.listing, self.client)
87
+ props
84
88
  end
85
- props
86
89
  end
87
90
 
88
91
  def mls_results?
@@ -1,3 +1,3 @@
1
1
  module YouGotListed
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: you_got_listed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Cocca