you_got_listed 0.2.1 → 0.2.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.
@@ -46,24 +46,18 @@ module YouGotListed
46
46
 
47
47
  def find_all_by_ids(listing_ids, include_off_market = true)
48
48
  listing_ids = listing_ids.split(',') if listing_ids.is_a?(String)
49
- mls_ids = []
50
- ygl_ids = []
51
49
  all_listings = []
52
- listing_ids.each do |list_id|
53
- if list_id =~ /[A-Z]{3}-[0-9]{3}-[0-9]{3}/
54
- ygl_ids << list_id
55
- else
56
- mls_ids << list_id
57
- end
50
+ search_params = {}
51
+ search_params[:include_off_market] = 1 if include_off_market
52
+ if listing_ids.any?{|list_id| list_id =~ /^[0-9]{8}$/}
53
+ search_params[:include_mls] = 1
58
54
  end
59
- ygl_ids.in_groups_of(500, false).each_with_index do |group, index|
60
- search_params = {:listing_ids => group.join(','), :page_count => 500, :page_index => (index + 1)}
61
- search_params[:include_off_market] = 1 if include_off_market
55
+ listing_ids.in_groups_of(500, false).each_with_index do |group, index|
62
56
  group.delete_if{|x| x.nil?}
63
- all_listings << find_all({:listing_ids => group.join(','), :page_count => 500, :page_index => (index + 1)})
64
- end
65
- mls_ids.each do |mls_id|
66
- all_listings << find_by_id(mls_id)
57
+ search_params[:listing_ids] = group.join(',')
58
+ search_params[:page_count] = 500
59
+ search_params[:page_index] = index + 1
60
+ all_listings << find_all(search_params)
67
61
  end
68
62
  all_listings.compact.flatten
69
63
  end
@@ -1,3 +1,3 @@
1
1
  module YouGotListed
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Cocca