caboose-rets 0.0.82 → 0.0.83
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 +8 -8
- data/app/models/caboose_rets/rets_importer.rb +35 -31
- data/lib/caboose_rets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzY3YmVlYjQ5ZDAzY2QzMDljZTg4ODBkMGU0YTZiYjUwMzNkYTNlOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmMzNTc5Mzc0MjkyODI4MWFmYjg3MzIxNWIzMmMxMzVmMDE4NDM5OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGY3MjI4NDJmYzg5ZDBkZjQxMWVlNmVmYjI3M2MyNWZhNjkyYjFiMzkxYTA5
|
10
|
+
YjMwN2YwOWJhN2I0MGEzYTAwNzVhMGNkMTIwOTA4ZGVlZTc3YTVhZmQ3OGZl
|
11
|
+
NmEzNTg2YWE0NjAzNzc3NTU3ZTE5OGU5MWEwODI5Zjg1ZWQyYjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzI0YjZkY2YzYmI2OWY4ODZkMTZiNTBlZDM5NmY3MzRmNmZhODQwM2RjNjQ1
|
14
|
+
NjJiMDQ4M2RiY2VmNWEyZjY3ZDAyNDkzNGE2MjM2MjEwNmNkMmI4MDkwMjll
|
15
|
+
Y2E2N2JiYmEzMDUxMTg5YmMyZjc2ODQzZTM3ODJjN2NhNzgxMzA=
|
@@ -254,15 +254,17 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
254
254
|
m.save
|
255
255
|
end
|
256
256
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
257
|
+
if ids.count > 0
|
258
|
+
# Delete any records in the local database that shouldn't be there
|
259
|
+
self.log("- Deleting GFX records for MLS ##{p.mls_acct} in the local database that are not in the remote database...")
|
260
|
+
query = "select media_id from rets_media where mls_acct = '#{p.mls_acct}'"
|
261
|
+
rows = ActiveRecord::Base.connection.select_all(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
262
|
+
local_ids = rows.collect{ |row| row['media_id'] }
|
263
|
+
ids_to_remove = local_ids - ids
|
264
|
+
if ids_to_remove && ids_to_remove.count > 0
|
265
|
+
query = ["delete from rets_media where media_id not in (?)", ids_to_remove]
|
266
|
+
ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
267
|
+
end
|
266
268
|
end
|
267
269
|
|
268
270
|
end
|
@@ -448,28 +450,30 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
448
450
|
end
|
449
451
|
end
|
450
452
|
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
453
|
+
if ids.count > 0
|
454
|
+
# Delete any records in the local database that shouldn't be there
|
455
|
+
t = m.local_table
|
456
|
+
k = m.local_key_field
|
457
|
+
query = ["delete from #{t} where #{k} not in (?)", ids]
|
458
|
+
ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
459
|
+
|
460
|
+
# Find any ids in the remote database that should be in the local database
|
461
|
+
query = "select distinct #{k} from #{t}"
|
462
|
+
rows = ActiveRecord::Base.connection.select_all(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
463
|
+
local_ids = rows.collect{ |row| row[k] }
|
464
|
+
ids_to_add = ids - local_ids
|
465
|
+
ids_to_add.each do |id|
|
466
|
+
self.log("Importing #{id}...")
|
467
|
+
case class_type
|
468
|
+
when 'RES' then self.delay.import_residential_property(id, false)
|
469
|
+
when 'COM' then self.delay.import_commercial_property(id, false)
|
470
|
+
when 'LND' then self.delay.import_land_property(id, false)
|
471
|
+
when 'MUL' then self.delay.import_multi_family_property(id, false)
|
472
|
+
when 'OFF' then self.delay.import_office(id, false)
|
473
|
+
when 'AGT' then self.delay.import_agent(id, false)
|
474
|
+
when 'OPH' then self.delay.import_open_house(id, false)
|
475
|
+
when 'GFX' then self.delay.import_media(id)
|
476
|
+
end
|
473
477
|
end
|
474
478
|
end
|
475
479
|
|
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.0.
|
4
|
+
version: 0.0.83
|
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-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caboose-cms
|