caboose-rets 0.1.184 → 0.1.185

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84ef101eafb83b5891a32f9557f355e5f46de43e3d1e544aad19e5a533e78b6e
4
- data.tar.gz: 1ddefc2dbff138dcb82eb3e4c879f9b19956726d2dd20ca134ec7106a45ce99e
3
+ metadata.gz: b7f22c4ab33e1c864cff0298d16551920513574e1d296ccc75fc5d52acc5c300
4
+ data.tar.gz: e79b67affd54f55d61a093ec355747fc5aba4b7d1ba46b6f3b85128599afe4a6
5
5
  SHA512:
6
- metadata.gz: 754a940a4a13708921c8e4b7bd05c311f04f14b448ac8cb6d6938c752f3f20960a7954465fa84530b3a9b0c8bc6b3cde2394414a6aa07981e5029e5b66aa5ce7
7
- data.tar.gz: 80eace42b684e7bb8a25b4c7e88263c596fd1cdb2bd41e6fe709b260ec8401675c6fad0c26e56fc341eb247a103d30f69c3550d20a969b097a19df7b7bcd5605
6
+ metadata.gz: 480f45304f7255a65af0f879097b469215d6d0f0de3fd3011a8a8b3e296eae682ea0d769f33872ac849cb34f2ae231bb1b72de60688beffc85d0746af9c82ec5
7
+ data.tar.gz: fde9c087f4a562ac5716a5776bbf12463b2ea8596217a82d8e62cdac0ab14ea12c2bf6f03c228df4b02fa55d90e49d7fb4790d0f7e6ae95c218b9b97b486070b
@@ -217,6 +217,17 @@ module CabooseRets
217
217
  render :json => resp
218
218
  end
219
219
 
220
+ # @route GET /api/rets-properties/:mls/photo
221
+ def dynamic_photo_url
222
+ render :json => false and return if !@site || !@site.use_rets
223
+ p = Property.where(:mls_number => params[:mls]).first
224
+ if p
225
+ redirect_to p.featured_photo_url, :status => 307 and return
226
+ else
227
+ redirect_to "https://cabooseit.s3.amazonaws.com/assets/pmre/house.png", :status => 307 and return
228
+ end
229
+ end
230
+
220
231
  # @route GET /admin/properties/:id/refresh
221
232
  def admin_refresh
222
233
  return unless (user_is_allowed_to 'edit', 'rets_properties')
@@ -18,7 +18,7 @@ class CabooseRets::Notification < ActiveRecord::Base
18
18
  user_ids.each do |user_id|
19
19
  user = Caboose::User.where(uwhere).where(:id => user_id, :tax_exempt => false).first
20
20
  d1 = DateTime.now - 24.hours
21
- if user
21
+ if user && user.site && user.site.use_rets
22
22
  # Check if a similar notification has already been sent
23
23
  n = CabooseRets::Notification.where(
24
24
  :user_id => user.id,
@@ -64,7 +64,7 @@ class CabooseRets::Notification < ActiveRecord::Base
64
64
  user_ids.each do |user_id|
65
65
  user = Caboose::User.where(uwhere).where(:id => user_id, :tax_exempt => false).first
66
66
  d1 = DateTime.now - 24.hours
67
- if user
67
+ if user && user.site && user.site.use_rets
68
68
  # Check if a similar notification has already been sent
69
69
  n = CabooseRets::Notification.where(
70
70
  :user_id => user.id,
@@ -33,6 +33,12 @@ class CabooseRets::Property <ActiveRecord::Base
33
33
  return img_url
34
34
  end
35
35
 
36
+ def dynamic_photo_url(site)
37
+ domain = site.primary_domain.domain
38
+ return "http://dev.pmre.com:3000/api/rets-properties/#{self.mls_number}/photo.jpg" if Rails.env.development?
39
+ return "https://#{domain}/api/rets-properties/#{self.mls_number}/photo.jpg"
40
+ end
41
+
36
42
  def agent
37
43
  CabooseRets::Agent.where(:mls_id => self.list_agent_mls_id).first
38
44
  end
@@ -257,9 +263,9 @@ class CabooseRets::Property <ActiveRecord::Base
257
263
  # self.zoning_tusc = data['ZoningTusc']
258
264
 
259
265
 
260
- if old_status != self.status # status was changed
266
+ if !old_status.blank? && old_status != self.status # status was changed
261
267
  CabooseRets::Notification.delay(:queue => "rets").property_status_changed(self, old_status)
262
- elsif old_price != self.list_price && self.status == 'Active' # price was changed
268
+ elsif !old_price.blank? && old_price != self.list_price && self.status == 'Active' # price was changed
263
269
  CabooseRets::Notification.delay(:queue => "rets").property_price_changed(self, old_price)
264
270
  end
265
271
 
@@ -1,10 +1,8 @@
1
- <table border="0" cellpadding="0" cellspacing="0" width="800" id="templateColumns" style="width:100%;margin:0 0 20px 0;text-align:left;">
1
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateColumns" style="width:100%;margin:0 0 20px 0;text-align:left;">
2
2
  <tr>
3
3
  <td align="left" valign="top" width="25%" class="templateColumnContainer" style="width:25%;padding:0;">
4
4
  <a style="display:block;text-decoration:none;" href="<%= url %>/properties/<%= p.mls_number %>/details">
5
- <% if p.featured_photo_url %>
6
- <img style="display:block;max-width:200px;height:auto;" width="200" alt="MLS # <%= p.mls_number %>" src="<%= p.featured_photo_url %>" />
7
- <% end %>
5
+ <img style="display:block;max-width:200px;height:auto;" width="200" alt="MLS # <%= p.mls_number %>" src="<%= p.dynamic_photo_url(@site) %>" />
8
6
  </a>
9
7
  </td>
10
8
  <td align="left" valign="top" width="37.5%" class="templateColumnContainer" style="width:37.5%;padding:5px 5px 5px 10px;">
@@ -19,8 +17,7 @@
19
17
  <p style="margin:0 0 5px 0;font-size:16px;line-height:18px;"><strong><%= number_to_currency(p.list_price, :precision => 0) %></strong></p>
20
18
  <p style="margin:0 0 5px 0;font-size:15px;line-height:17px;">
21
19
  <% if !p.beds_total.blank? %><span><strong><%= p.beds_total %></strong> beds</span><br /><% end %>
22
- <% if !p.baths_full.blank? %><span><strong><%= p.baths_full %></strong> baths</span><br /><% end %>
23
- <% if !p.baths_half.blank? && p.baths_half > 0 %><span><strong><%= p.baths_half %></strong> ½ baths</span><br /><% end %>
20
+ <% if !p.baths_full.blank? %><span><strong><%= p.baths_full %>&nbsp;<% if !p.baths_half.blank? && p.baths_half > 0 %><%= p.baths_half %>&nbsp;½<% end %></strong>baths</span><br /><% end %>
24
21
  <% if !p.sqft_total.blank? %><span><strong><%= number_with_delimiter(p.sqft_total.to_i, :delimiter => ',') %></strong> sqft</span><% end %>
25
22
  </p>
26
23
  <% if !p.original_entry_timestamp.blank? %>
@@ -20,7 +20,7 @@
20
20
  <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
21
21
  <tr>
22
22
  <td align="center" valign="top">
23
- <table border="0" cellpadding="20" cellspacing="0" width="800" id="emailContainer">
23
+ <table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailContainer">
24
24
  <tr>
25
25
  <td align="center" valign="top">
26
26
 
@@ -32,7 +32,7 @@
32
32
  </a>
33
33
  </div>
34
34
 
35
- <div style="text-align:center;padding:20px;">
35
+ <div style="text-align:center;padding:20px;max-width:800px;margin:0 auto;">
36
36
  <h2>New and Suggested Listings</h2>
37
37
 
38
38
  <% if @new_listings.count > 0 %>
@@ -20,7 +20,7 @@
20
20
  <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
21
21
  <tr>
22
22
  <td align="center" valign="top">
23
- <table border="0" cellpadding="20" cellspacing="0" width="800" id="emailContainer">
23
+ <table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailContainer">
24
24
  <tr>
25
25
  <td align="center" valign="top">
26
26
 
@@ -32,7 +32,7 @@
32
32
  </a>
33
33
  </div>
34
34
 
35
- <div style="text-align:center;padding:20px;">
35
+ <div style="text-align:center;padding:20px;max-width:800px;margin:0 auto;">
36
36
  <h2>Price Changed</h2>
37
37
 
38
38
  <% if @property %>
@@ -20,7 +20,7 @@
20
20
  <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
21
21
  <tr>
22
22
  <td align="center" valign="top">
23
- <table border="0" cellpadding="20" cellspacing="0" width="800" id="emailContainer">
23
+ <table border="0" cellpadding="20" cellspacing="0" width="100%" id="emailContainer">
24
24
  <tr>
25
25
  <td align="center" valign="top">
26
26
 
@@ -32,7 +32,7 @@
32
32
  </a>
33
33
  </div>
34
34
 
35
- <div style="text-align:center;padding:20px;">
35
+ <div style="text-align:center;padding:20px;max-width:800px;margin:0 auto;">
36
36
  <h2>Status Changed</h2>
37
37
 
38
38
  <% if @property %>
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.1.184'
2
+ VERSION = '0.1.185'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-rets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.184
4
+ version: 0.1.185
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2021-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms