Skip to content

Commit 484df5a

Browse files
committed
added Listings to saved search
1 parent 87a6432 commit 484df5a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/spark_api/models/saved_search.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def self.provided()
1919
Class.new(self).tap do |provided|
2020
provided.element_name = '/savedsearches'
2121
provided.prefix = '/provided'
22+
def is_provided_search?
23+
true
24+
end
2225
SparkApi.logger.info("#{self.name}.path: #{provided.path}")
2326
end
2427
end
@@ -56,6 +59,11 @@ def contacts
5659
end
5760
end
5861

62+
def listings(args = {})
63+
arguments = {:_filter => self.Filter}.merge(args)
64+
@listings ||= Listing.collect(connection.get("/listings", arguments))
65+
end
66+
5967
def newsfeeds
6068
if @newsfeeds.nil?
6169
response = SparkApi.client.get("/savedsearches/#{@attributes["Id"]}", _expand: "NewsFeeds").first["NewsFeeds"]
@@ -65,8 +73,14 @@ def newsfeeds
6573
@newsfeeds
6674
end
6775

76+
def is_provided_search?
77+
false
78+
end
79+
6880
def can_have_newsfeed?
6981

82+
return false if is_provided_search?
83+
7084
standard_fields = %w(BathsTotal BedsTotal City CountyOrParish ListPrice Location MlsStatus PostalCode PropertyType RoomsTotal State)
7185

7286
number_of_filters = 0

0 commit comments

Comments
 (0)