realogy 0.6.5 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/realogy/app/models/realogy/entity.rb +8 -4
- data/lib/realogy/tasks/realogy.rake +2 -2
- data/lib/realogy/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: 676ad6c5b9fd8669e24ae130575c8944ed18a2984100f2357405893da10fd4e3
|
4
|
+
data.tar.gz: c8e309850a69a03e096a184ee4cf7ea61755d34cd2738b4958828a1a1b596a82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a5e8b6547497b3c472649c98e811bd0a1b5e0b1fca9816eb657709f439c7c4aee27bf3186f817e1b82dea9071b7765f761a48d1b6fa4b91a7a9f41cca12d3e5
|
7
|
+
data.tar.gz: 73be3e042bc5f98313e7a0bab560292e023cd49c03e7df1bb93dda4f2e10d792e229848214fa131d15c93056effe67f4d74e2ed43a2e002edab90b48e47aa278
|
@@ -2,7 +2,7 @@ class Realogy::Entity < ApplicationRecord
|
|
2
2
|
self.table_name = 'realogy_entities'
|
3
3
|
|
4
4
|
validates :type, presence: true
|
5
|
-
validates :entity_id, presence: true
|
5
|
+
validates :entity_id, presence: true, uniqueness: true
|
6
6
|
validates :last_update_on, presence: true
|
7
7
|
|
8
8
|
def needs_updating?
|
@@ -14,10 +14,14 @@ class Realogy::Entity < ApplicationRecord
|
|
14
14
|
@object.last_update_on = hash["lastUpdateOn"].to_s.to_datetime
|
15
15
|
@object.populate if @object.needs_updating?
|
16
16
|
end
|
17
|
-
|
18
|
-
def
|
17
|
+
|
18
|
+
def get_data
|
19
19
|
call = ["get_", self.class.to_s.downcase.split("::").last, "_by_id"].join.to_sym
|
20
|
-
|
20
|
+
Realogy::DataSync.client.__send__(call, self.entity_id)
|
21
|
+
end
|
22
|
+
|
23
|
+
def populate
|
24
|
+
result = get_data
|
21
25
|
self.data = result unless result.blank?
|
22
26
|
self.save if self.changed?
|
23
27
|
end
|
@@ -95,14 +95,14 @@ namespace :realogy do
|
|
95
95
|
def perform_delta_update_for klass, since
|
96
96
|
return unless %w(agents companies listings offices teams).include?(plural = klass.to_s.tableize.split("/").last)
|
97
97
|
call = "get_#{plural}_delta".to_sym
|
98
|
-
Realogy::DataSync.client.send(call, {since: since.to_i.minutes.ago}).each do |hash|
|
98
|
+
Realogy::DataSync.client.send(call, {since: since.to_i.minutes.ago, followNext: true}).each do |hash|
|
99
99
|
case hash["action"]
|
100
100
|
when "Delete"
|
101
101
|
klass.find_by(entity_id: hash["id"]).try(:destroy)
|
102
102
|
when "Upsert"
|
103
103
|
hash["class"] = klass.to_s
|
104
104
|
active_job_configured? ? PopulateRealogyEntityJob.perform_later(hash) : klass::triage(hash)
|
105
|
-
end
|
105
|
+
end
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
data/lib/realogy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: realogy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Edlund
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|