you_got_listed 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -50,7 +50,7 @@ module YouGotListed
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def pictures
|
53
|
-
self.photos.photo unless self.photos.blank? || self.photos.photo.blank?
|
53
|
+
(self.photos.photo.is_a?(Array) ? self.photos.photo : [self.photos.photo]) unless self.photos.blank? || self.photos.photo.blank?
|
54
54
|
end
|
55
55
|
|
56
56
|
def main_picture
|
@@ -52,10 +52,10 @@ module YouGotListed
|
|
52
52
|
if listing_ids.any?{|list_id| list_id !=~ /[A-Z]{3}-[0-9]{3}-[0-9]{3}/}
|
53
53
|
search_params[:include_mls] = 1
|
54
54
|
end
|
55
|
-
|
55
|
+
# YGL no longer allows you to pass more than 10 ids at a time
|
56
|
+
listing_ids.in_groups_of(10, false).each_with_index do |group, index|
|
56
57
|
group.delete_if{|x| x.nil?}
|
57
58
|
search_params[:listing_ids] = group.join(',')
|
58
|
-
search_params[:page_count] = 500
|
59
59
|
search_params[:page_index] = index + 1
|
60
60
|
all_listings << find_all(search_params)
|
61
61
|
end
|
data/lib/you_got_listed.rb
CHANGED
@@ -81,6 +81,14 @@ describe YouGotListed::Listing do
|
|
81
81
|
@listing.stub!(:pictures).and_return(nil)
|
82
82
|
@listing.main_picture.should be_nil
|
83
83
|
end
|
84
|
+
|
85
|
+
it "should return an array if the property has only one photo" do
|
86
|
+
rash = valid_listing_rash
|
87
|
+
rash[:photos].merge!(:photo => 'http://ygl-photos.s3.amazonaws.com/1236380.jpg')
|
88
|
+
@listing = YouGotListed::Listing.new(rash, @ygl)
|
89
|
+
@listing.pictures.is_a?(Array).should be_true
|
90
|
+
@listing.main_picture.should == 'http://ygl-photos.s3.amazonaws.com/1236380.jpg'
|
91
|
+
end
|
84
92
|
end
|
85
93
|
|
86
94
|
context "latitude" do
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Cocca
|