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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5039e6efbc758a59d7743e78525b6ba911579c839c36346568357c0a97a30600
4
- data.tar.gz: ac4fae9724a255429f9b08aa6e88680a28af5f2d68c52cbcdfbe66d86d474814
3
+ metadata.gz: 70b0f4e86ff5ef5d73cdd73f81bd547626494a410af69c62ae3e96706b75c863
4
+ data.tar.gz: 8ecb71bd7e251e3917a7342c6b74b4e3519f9e212b84da0ec112964b49634fef
5
5
  SHA512:
6
- metadata.gz: d98adeebde67af3a79e0e5e21823c9f7069feb403b6c5fa65136a436fbb6338eb7a6b2e233b61c8a7d5d0e74f6548e087a0bc52417da0178e2e046f8d7c2275b
7
- data.tar.gz: 8b2ea5a405261cac394fd8f52790502eb4860b5a1143aadbcf9f74ccceb75c5afce8ba146467c0434b65cc6ffba7320e798b6098dab46d23c320ad43882afcb5
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 = Caboose::Media.new
294
- cm.image = File.open(tmp_path)
295
- cm.name = "rets_media_#{headers['content-id']}_#{ind}"
296
- cm.original_name = "rets_media_#{headers['content-id']}_#{ind}.jpeg"
297
- cm.processed = true
298
- cm.save
299
- #puts cm
300
- if cm
301
- m.media_id = cm.id
302
- m.save
303
- self.log3("Media",p.mls_number,"Created new RetsMedia object #{m.id}, CabooseMedia object #{cm.id}")
304
- `rm #{tmp_path}`
305
- self.log3("Media",p.mls_number,"Image rets_media_#{headers['content-id']}_#{ind} saved")
306
- else
307
- self.log3("Media",p.mls_number,"CabooseMedia was not created, not saving image")
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
 
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.1.93'
2
+ VERSION = '0.1.94'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-rets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.93
4
+ version: 0.1.94
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry