File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ module Models
3
3
class Newsfeed < Base
4
4
5
5
extend Finders
6
+ include Concerns ::Savable
6
7
7
8
self . element_name = 'newsfeeds'
8
-
9
+
9
10
end
10
11
end
11
12
end
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ def can_have_newsfeed?
81
81
82
82
return false if is_provided_search?
83
83
84
+ # Newsfeed restriction criteria for saved searches:
85
+ # http://alpha.sparkplatform.com/docs/api_services/newsfeed/restrictions#criteria
84
86
standard_fields = %w( BathsTotal BedsTotal City CountyOrParish ListPrice Location MlsStatus PostalCode PropertyType RoomsTotal State )
85
87
86
88
number_of_filters = 0
@@ -93,7 +95,7 @@ def can_have_newsfeed?
93
95
94
96
end
95
97
96
- def has_newsfeed ?
98
+ def has_active_newsfeed ?
97
99
if self . respond_to? "NewsFeedSubscriptionSummary"
98
100
self . NewsFeedSubscriptionSummary [ 'ActiveSubscription' ]
99
101
else
@@ -102,6 +104,15 @@ def has_newsfeed?
102
104
end
103
105
end
104
106
107
+ def has_inactive_newsfeed?
108
+ if self . respond_to? "NewsFeedSubscriptionSummary"
109
+ !self . NewsFeedSubscriptionSummary [ 'ActiveSubscription' ]
110
+ else
111
+ saved_search = SavedSearch . find ( self . Id , { "_expand" => "NewsFeedSubscriptionSummary" } )
112
+ !saved_search . NewsFeedSubscriptionSummary [ 'ActiveSubscription' ]
113
+ end
114
+ end
115
+
105
116
private
106
117
107
118
def resource_pluralized ; "SavedSearches" end
You can’t perform that action at this time.
0 commit comments