lib/rentjuicer/listings.rb in rentjuicer-0.6.2 vs lib/rentjuicer/listings.rb in rentjuicer-0.6.3

- old
+ new

@@ -18,12 +18,12 @@ def featured(params = {}) params.merge!(:featured => 1) search(params) end - def find_by_id(listing_id) - response = SearchResponse.new(self.client.process_get(resource, {:rentjuice_id => listing_id})) + def find_by_id(listing_id, params = {}) + response = SearchResponse.new(self.client.process_get(resource, params.merge(:rentjuice_id => listing_id))) (response.success? && response.properties.size > 0) ? response.properties.first : nil end def find_all(params = {}) per_page = params[:limit] || 20 @@ -43,15 +43,15 @@ end end all_listings.flatten end - def find_all_by_ids(listing_ids) + def find_all_by_ids(listing_ids, params = {}) listing_ids = listing_ids.split(',') if listing_ids.is_a?(String) all_listings = [] listing_ids.in_groups_of(500, false).each do |group| group.delete_if{|x| x.nil?} - all_listings << find_all(:rentjuice_id => group.join(',')) + all_listings << find_all(params.merge(:rentjuice_id => group.join(','))) end all_listings.flatten end class SearchResponse < Rentjuicer::Response