caboose-rets 0.1.118 → 0.1.119
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/caboose_rets/property.rb +13 -0
- data/app/models/caboose_rets/rets_importer.rb +7 -2
- data/lib/caboose_rets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeb377c80744124361580027e24e96fc75c3a6831cf6d718d14f52b675d9912f
|
4
|
+
data.tar.gz: d0ce221bbc719c75b0c5fc201e247dcaf0157be015a66b490ec948b28ff9f967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e23514e4d183cf3cf8155b160561fe44b857fe6101e6bab41f4181205e89b62afcbf6f71f3ffbddd8ad11399f11f82ee1e76e265c78b39d4716303d4d3f16942
|
7
|
+
data.tar.gz: 5c12d11a6a3bbd966e9a671c95064458c017650de5393b064570ad19405caf5b83c7f34b2a14b4eeb13180fafec5993ba81b5e004cbf558a0c353c63b7c4e46a
|
@@ -18,6 +18,19 @@ class CabooseRets::Property <ActiveRecord::Base
|
|
18
18
|
CabooseRets::RetsImporter.import_properties(self.mls_number, true)
|
19
19
|
end
|
20
20
|
|
21
|
+
def featured_photo_url
|
22
|
+
img_url = nil
|
23
|
+
self.images.each do |img|
|
24
|
+
m = Caboose::Media.where(:id => img.media_id).first
|
25
|
+
if m && m.image && m.image.url(:large)
|
26
|
+
img_url = m.image.url(:large)
|
27
|
+
return img_url
|
28
|
+
break
|
29
|
+
end
|
30
|
+
end
|
31
|
+
return img_url
|
32
|
+
end
|
33
|
+
|
21
34
|
def agent
|
22
35
|
CabooseRets::Agent.where(:mls_id => self.list_agent_mls_id).first
|
23
36
|
end
|
@@ -275,7 +275,7 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
275
275
|
# rows = ActiveRecord::Base.connection.select_all(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
276
276
|
# local_ids = rows.collect{ |row| row['media_id'] }
|
277
277
|
# ids_to_remove = local_ids - ids
|
278
|
-
# if ids_to_remove && ids_to_remove.count > 0
|
278
|
+
# if ids_to_remove && ids_to_remove.count > 0
|
279
279
|
# query = ["delete from rets_media where media_id in (?)", ids_to_remove]
|
280
280
|
# ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
281
281
|
# end
|
@@ -303,6 +303,7 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
303
303
|
m.media_order = ind
|
304
304
|
m.media_type = 'Photo'
|
305
305
|
cm = nil
|
306
|
+
old_cm_id = is_new ? nil : m.media_id
|
306
307
|
begin
|
307
308
|
cm = Caboose::Media.new
|
308
309
|
cm.image = File.open(tmp_path)
|
@@ -317,6 +318,11 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
317
318
|
if is_new
|
318
319
|
self.log3("Media",p.mls_number,"Created new RetsMedia object #{m.id}, media_id = #{m.media_id}")
|
319
320
|
else
|
321
|
+
old_media = Caboose::Media.where(:id => old_cm_id).first
|
322
|
+
if old_media
|
323
|
+
self.log3("Media",p.mls_number,"Deleting old CabooseMedia #{old_media.id}")
|
324
|
+
old_media.destroy
|
325
|
+
end
|
320
326
|
self.log3("Media",p.mls_number,"RetsMedia object already existed #{m.id}, updated media_id = #{m.media_id}")
|
321
327
|
end
|
322
328
|
self.log3("Media",p.mls_number,"Image rets_media_#{headers['content-id']}_#{ind} saved")
|
@@ -548,7 +554,6 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
548
554
|
ids_to_remove = local_ids - ids
|
549
555
|
self.log3(class_type,nil,"Found #{ids_to_remove.count} #{class_type} records in the local database that are not in the remote database.")
|
550
556
|
|
551
|
-
|
552
557
|
# Delete all RetsMedia and CabooseMedia for the deleted property listings
|
553
558
|
if class_type == 'Property' && ids_to_remove && ids_to_remove.count > 0
|
554
559
|
self.log3(class_type,nil,"Deleting Media objects that shouldn't be there...")
|
data/lib/caboose_rets/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.119
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caboose-cms
|