caboose-rets 0.1.93 → 0.1.94
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/rets_importer.rb +21 -17
- data/lib/caboose_rets/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70b0f4e86ff5ef5d73cdd73f81bd547626494a410af69c62ae3e96706b75c863
|
4
|
+
data.tar.gz: 8ecb71bd7e251e3917a7342c6b74b4e3519f9e212b84da0ec112964b49634fef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e1bd9bb94237bdc228e005681c867adb2363b0de867708b314f0e5670499e0754daf63753b889b721dad1da210c0eb6c25b21602ef90c778a132b16e6b4fcd
|
7
|
+
data.tar.gz: 938b363a71349969587c8a6036642576791cd61f388365d3cd055426a0c5350e84c515b5e533fad3cdf943f06b04d042a2c6622a51da76dad9c2e0da3927a734
|
@@ -275,8 +275,7 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
275
275
|
|
276
276
|
def self.download_property_images(p)
|
277
277
|
self.log3('Property',p.mls_number,"Downloading images for #{p.mls_number}...")
|
278
|
-
|
279
|
-
self.client.get_object(:resource => 'Property', :type => 'Photo', :location=> false, :id => "#{p.matrix_unique_id}:*") do |headers, content|
|
278
|
+
self.client.get_object(:resource => 'Property', :type => 'Photo', :location => false, :id => "#{p.matrix_unique_id}:*") do |headers, content|
|
280
279
|
next if headers.blank?
|
281
280
|
ind = headers['orderhint'] ? headers['orderhint'].to_i : 0
|
282
281
|
self.log3('Media',p.mls_number,headers.to_s)
|
@@ -290,22 +289,27 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
290
289
|
m.media_mui = headers['content-id']
|
291
290
|
m.media_order = ind
|
292
291
|
m.media_type = 'Photo'
|
293
|
-
cm
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
292
|
+
cm = nil
|
293
|
+
begin
|
294
|
+
cm = Caboose::Media.new
|
295
|
+
cm.image = File.open(tmp_path)
|
296
|
+
cm.name = "rets_media_#{headers['content-id']}_#{ind}"
|
297
|
+
cm.original_name = "rets_media_#{headers['content-id']}_#{ind}.jpeg"
|
298
|
+
cm.processed = true
|
299
|
+
cm.save
|
300
|
+
if cm && !cm.id.blank?
|
301
|
+
self.log3("Media",p.mls_number,"Created new CabooseMedia object #{cm.id}, setting media_id...")
|
302
|
+
m.media_id = cm.id
|
303
|
+
else
|
304
|
+
self.log3("Media",p.mls_number,"CabooseMedia was not created for some reason")
|
305
|
+
end
|
306
|
+
rescue
|
307
|
+
self.log3("Media",p.mls_number,"CabooseMedia was not created for some other reason")
|
308
308
|
end
|
309
|
+
m.save
|
310
|
+
self.log3("Media",p.mls_number,"Created new RetsMedia object #{m.id}, media_id = #{m.media_id}")
|
311
|
+
`rm #{tmp_path}`
|
312
|
+
self.log3("Media",p.mls_number,"Image rets_media_#{headers['content-id']}_#{ind} saved")
|
309
313
|
end
|
310
314
|
|
311
315
|
|
data/lib/caboose_rets/version.rb
CHANGED