caboose-rets 0.0.71 → 0.0.72

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTc1MzEzZTk0Yjk3NGFlY2UyMWJhMTk5NmExNWI0ZDI1YWE5NmVlZA==
4
+ MmM1YTNiYmFhODI2ZjdkZTQ2ZmFhMzY5ZGJjNDQ1ZWMzMDAzZDA3Mg==
5
5
  data.tar.gz: !binary |-
6
- OGQyNDczYjQyNThjMzM2NDAzM2QzNDZhNTI3MDY2NTAxNmExYTJjMw==
6
+ ZTRjMDc1M2ExODFjNmQzN2FmNTU1MTVmMzIwYjU1YjA3MTE4YWU5YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzhjY2Y1YWMxYzg1YWIyNzNiZGI0ZWM2OWZiY2ExNDFjNzJkYjZlMzM0OTJi
10
- N2RlNzcxZjhmNjQ1YWFjOWJiY2NlNjQ2OGI5YWIyZWI4MjMyZGZhMTliYTQy
11
- NzliNmIxYTUxYjI1OGYxNjU1ODllNzdkZDcxNTgwMTMxNTUzMjg=
9
+ NWM4NGE1YjIyMDYzN2Y0MmMzZjZkZjJjODI5YjdiYWI3MzEzODFmZmUxZDNm
10
+ NDM2ODQ5ZTQxNjlkOTEzMGQxZmFkMGI5NTkxYWZmM2NhYWMzMDRkOGE0NDIy
11
+ YzA1OWVlMjg4ODU2MGY3ZGExZjk0YzFmNDAwY2M5OTBlOTFhM2E=
12
12
  data.tar.gz: !binary |-
13
- N2Q4YWMzODc5YjY1YzlkZmUxOWU5OTYxNjVmZjNlN2NlYWU4ODQzMDVmODky
14
- NWZkZTVkOTE5NGNhYjI1ZjM5MTg0MDRjNGVjMDQzYzJlYjY3YzYwYTcwYmY2
15
- ZWY5MmUzZjhlNjdkZWY5M2UzMDE0MmRkNjA2Mjk1OTA2ZGU0YTE=
13
+ M2NlNmJhMDg4ZDVmN2IyNDRjYzI1MDEyYzk1ZDgxN2RiNjJjMDU2MWU5YWVm
14
+ YzUyMDI1NTljZmNjNzJhZjc2ZTcwYzFlNzY1M2YwMjIzOGI1MDNhMmFlZDE2
15
+ MTEyZTUwODVkNDlhNTRjYjg3ZDU4MzA3YjcxNWNjNThkODI2M2Y=
@@ -79,10 +79,10 @@ class CabooseRets::Agent < ActiveRecord::Base
79
79
 
80
80
  def image_url(style)
81
81
  if CabooseRets::use_hosted_images == true
82
- return "#{CabooseRets::agents_base_url}/#{self.image_file_name}"
82
+ return "#{CabooseRets::agents_base_url}/#{self.image_location}"
83
83
  end
84
84
  return "" if self.image.nil?
85
85
  return self.image.url(style)
86
86
  end
87
-
87
+
88
88
  end
@@ -219,7 +219,7 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
219
219
  def self.import_agent(la_code, save_images = true)
220
220
  self.import('AGT', "(LA_LA_CODE=*#{la_code}*)")
221
221
  a = CabooseRets::Agent.where(:la_code => la_code.to_s).first
222
- self.download_agent_image(a) if save_images == true
222
+ self.download_agent_image(a) #if save_images == true
223
223
  end
224
224
 
225
225
  def self.import_open_house(id, save_images = true)
@@ -265,6 +265,18 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
265
265
  end
266
266
 
267
267
  end
268
+
269
+ def self.download_agent_image(agent)
270
+ self.log "Saving image for #{agent.first_name} #{agent.last_name}..."
271
+ begin
272
+ self.client.get_object(:resource => :Agent, :type => :Photo, :location => true, :id => agent.la_code) do |headers, content|
273
+ agent.image_location = headers['location']
274
+ agent.save
275
+ end
276
+ rescue RETS::APIError => err
277
+ self.log "No image for #{agent.first_name} #{agent.last_name}."
278
+ end
279
+ end
268
280
 
269
281
  #=============================================================================
270
282
  # GPS
@@ -474,7 +486,7 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
474
486
 
475
487
  begin
476
488
  overlap = 30.seconds
477
- if (DateTime.now - self.last_purged).to_i > 1
489
+ if (DateTime.now - self.last_purged).to_i >= 1
478
490
  self.purge
479
491
  self.save_last_purged(task_started)
480
492
  #overlap = 1.month
@@ -56,7 +56,8 @@ class CabooseRets::Schema < Caboose::Utilities::Schema
56
56
  [ :bio , :text ],
57
57
  [ :contact_info , :text ],
58
58
  [ :assistant_to , :string ],
59
- [ :designation , :string ]
59
+ [ :designation , :string ],
60
+ [ :image_location , :string ]
60
61
  ],
61
62
  CabooseRets::CommercialProperty => [
62
63
  [ :acreage , :text ],
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.0.71'
2
+ VERSION = '0.0.72'
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.0.71
4
+ version: 0.0.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms