realogy 0.6.4 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/realogy/app/models/date_time.rb +2 -2
- data/lib/realogy/app/models/realogy/entity.rb +8 -4
- data/lib/realogy/tasks/realogy.rake +1 -1
- 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: af21ce6dbe48615c3a3ecc256c80e8a040d0b6509fdc519daea7f5427cc48cda
|
4
|
+
data.tar.gz: c8e39d729c23718404fc01cebe9a99f2d07fb14be2113512025e0881ce4ab25e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc34e6fe481234ded70d4d5de236e2c4af525471895d64a66451ef817f4a299dae6efd918d750a0a511e9f4528122f50275070b2e985d57ea5cbedec3ac55bbc
|
7
|
+
data.tar.gz: f065a69112faaba033180837cc7b0086f5582dfa3afff86c287ce99d1fbb8797245867e7c9b44b598042ff4d88b873446e45eace0ed86a4381a85507a05e9bde
|
data/README.md
CHANGED
@@ -219,26 +219,26 @@ When passing in `followNext: true`, the returned result will be an array of enti
|
|
219
219
|
To retrieve all listings, `fromDate` and `brandCode` are mandatory parameters. A minimum call to retrieve all listing entities could look like this:
|
220
220
|
|
221
221
|
```ruby
|
222
|
-
realogy.get_all_listings(brandCode: "COR", fromDate: 1.week.ago.
|
222
|
+
realogy.get_all_listings(brandCode: "COR", fromDate: 1.week.ago.json_string)
|
223
223
|
```
|
224
224
|
|
225
225
|
These are additional filters that can be applied:
|
226
226
|
|
227
227
|
```ruby
|
228
|
-
# fromDate and toDate must be converted to supported text format. This is done with
|
229
|
-
realogy.get_all_listings(brandCode: "COR", fromDate: 1.week.ago.
|
228
|
+
# fromDate and toDate must be converted to supported text format. This is done with json_string:
|
229
|
+
realogy.get_all_listings(brandCode: "COR", fromDate: 1.week.ago.json_string, toDate: DateTime.now.json_string)
|
230
230
|
|
231
231
|
# Allowed type values: ForSale, ForRent, ForSaleCommercial, & ForLeaseCommercial
|
232
|
-
realogy.get_all_listings(brandCode: "C21", fromDate: 1.week.ago.
|
232
|
+
realogy.get_all_listings(brandCode: "C21", fromDate: 1.week.ago.json_string, type: "ForSale")
|
233
233
|
|
234
234
|
# Allowed status values: Active, Available, Pending, & Closed
|
235
|
-
realogy.get_all_listings(brandCode: "CB", fromDate: 1.week.ago.
|
235
|
+
realogy.get_all_listings(brandCode: "CB", fromDate: 1.week.ago.json_string, status: "Active")
|
236
236
|
|
237
237
|
# Limit results to a particular country
|
238
|
-
realogy.get_all_listings(brandCode: "SIR", fromDate: 1.week.ago.
|
238
|
+
realogy.get_all_listings(brandCode: "SIR", fromDate: 1.week.ago.json_string, countryCode: "IT")
|
239
239
|
|
240
240
|
# Limit number of listings per result batch. Allowed span: 10–1000.
|
241
|
-
realogy.get_all_listings(brandCode: "BHG", fromDate: 1.week.ago.
|
241
|
+
realogy.get_all_listings(brandCode: "BHG", fromDate: 1.week.ago.json_string, limit: 10)
|
242
242
|
|
243
243
|
```
|
244
244
|
|
@@ -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,7 +95,7 @@ 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)
|
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.7
|
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
|