realogy 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -7
- data/lib/realogy/app/models/data_sync.rb +24 -1
- data/lib/realogy/app/models/date_time.rb +11 -0
- data/lib/realogy/version.rb +1 -1
- data/lib/realogy.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f02721407645903a2d9ac60db41b1d8cbf634ca114dda8a59d30adc2f965de8c
|
4
|
+
data.tar.gz: 71e9bdeccb476d4410210361cc296a3185c683f63601da6d01f9560b1e9e8c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f761f642d02074648b93393a673e8174f1152b3f5b4227a073bcfbabbd9fef33edd806c65742becbd1f27a7dcd4a7a4e2e1847a2071afe51774b68a7b07de179
|
7
|
+
data.tar.gz: 5c0327820519b16c455ef8b6b4f7b8da293c4a4ac2b9558dbaca5f1feaf4217c9a60b104bca774d6434d45db67abdd47fceb8ef4372fc7cd25a165ce6ffac7ed
|
data/README.md
CHANGED
@@ -128,9 +128,10 @@ config.active_job.queue_adapter = :delayed_job
|
|
128
128
|
```ruby
|
129
129
|
realogy = Realogy::DataSync.client
|
130
130
|
```
|
131
|
-
#### Retrieve array of objects
|
132
131
|
|
133
|
-
|
132
|
+
#### Get active objects
|
133
|
+
|
134
|
+
The calls to retrieve active entities are:
|
134
135
|
|
135
136
|
```ruby
|
136
137
|
realogy.get_active_agents
|
@@ -140,20 +141,31 @@ realogy.get_active_offices
|
|
140
141
|
realogy.get_active_teams
|
141
142
|
```
|
142
143
|
|
143
|
-
When no argument is submitted, all entities are returned.
|
144
|
+
When no argument is submitted, all active entities are returned.
|
145
|
+
|
146
|
+
Filters can be applied for `brandCode` and `countryCode`. For example:
|
144
147
|
|
145
148
|
```ruby
|
146
149
|
# Fetch all active agents, for all brands, in all countries:
|
147
|
-
realogy.get_active_agents
|
150
|
+
realogy.get_active_agents
|
148
151
|
|
149
152
|
# Fetch all active agents, for all brands, in Sweden:
|
150
|
-
realogy.
|
153
|
+
realogy.get_active_companies(countryCode: "SE")
|
151
154
|
|
155
|
+
# Allowed brandCode values: C21, CB, ERA, SIR, BHG, CBC, ZIP, CLB, & COR
|
152
156
|
# Fetch all active Sotheby's agents in all countries:
|
153
|
-
realogy.
|
157
|
+
realogy.get_active_offices(brandCode: "SIR")
|
154
158
|
|
155
159
|
# Fetch all active Sotheby's agents in Sweden:
|
156
|
-
realogy.
|
160
|
+
realogy.get_active_teams(brandCode: "SIR", countryCode: "SE")
|
161
|
+
```
|
162
|
+
|
163
|
+
When fetching listings, the type of listing can also be specified:
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
# Allowed type values: ForSale, ForRent, ForSaleCommercial, & ForLeaseCommercial
|
167
|
+
# Fetch all active agents, for all brands, in all countries:
|
168
|
+
realogy.get_active_listings(type: "ForSale")
|
157
169
|
```
|
158
170
|
|
159
171
|
#### Retrieve delta of objects
|
@@ -180,6 +192,35 @@ realogy.get_offices_delta({since: 5.minutes.ago})
|
|
180
192
|
realogy.get_teams_delta({since: 1.day.ago})
|
181
193
|
```
|
182
194
|
|
195
|
+
#### Get all listings
|
196
|
+
|
197
|
+
To retrieve all listings, `fromDate` and `brandCode` are mandatory parameters. A minimum call to retrieve all listing entities could look like this:
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
realogy.get_all_listings(brandCode: "COR", fromDate: 1.week.ago.to_query_string)
|
201
|
+
```
|
202
|
+
|
203
|
+
These are additional filters that can be applied:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
# fromDate and toDate must be converted to supported text format. This is done with to_query_string:
|
207
|
+
realogy.get_all_listings(brandCode: "COR", fromDate: 1.week.ago.to_query_string, toDate: DateTime.now.to_query_string)
|
208
|
+
|
209
|
+
# Allowed type values: ForSale, ForRent, ForSaleCommercial, & ForLeaseCommercial
|
210
|
+
realogy.get_all_listings(brandCode: "C21", fromDate: 1.week.ago.to_query_string, type: "ForSale")
|
211
|
+
|
212
|
+
# Allowed status values: Active, Available, Pending, & Closed
|
213
|
+
realogy.get_all_listings(brandCode: "CB", fromDate: 1.week.ago.to_query_string, status: "Active")
|
214
|
+
|
215
|
+
# Limit results to a particular country
|
216
|
+
realogy.get_all_listings(brandCode: "SIR", fromDate: 1.week.ago.to_query_string, countryCode: "IT")
|
217
|
+
|
218
|
+
# Limit number of listings per result batch. Allowed span: 10–1000.
|
219
|
+
realogy.get_all_listings(brandCode: "BHG", fromDate: 1.week.ago.to_query_string, limit: 10)
|
220
|
+
|
221
|
+
```
|
222
|
+
|
223
|
+
|
183
224
|
#### Retrieve JSON object
|
184
225
|
|
185
226
|
```ruby
|
@@ -23,6 +23,10 @@ module Realogy
|
|
23
23
|
get_active_teams: "teams/active"
|
24
24
|
}
|
25
25
|
|
26
|
+
ALL_API_ENDPOINTS = {
|
27
|
+
get_all_listings: "listings/all"
|
28
|
+
}
|
29
|
+
|
26
30
|
DELTA_API_ENDPOINTS = {
|
27
31
|
get_agents_delta: "agents/delta",
|
28
32
|
get_companies_delta: "companies/delta",
|
@@ -47,7 +51,26 @@ module Realogy
|
|
47
51
|
endpoint = ACTIVE_API_ENDPOINTS[method_name]
|
48
52
|
params = {
|
49
53
|
'brandCode': hash[:brandCode],
|
50
|
-
'countryCode': hash[:countryCode]
|
54
|
+
'countryCode': hash[:countryCode],
|
55
|
+
'type': hash[:type]
|
56
|
+
}.compact
|
57
|
+
return perform_api_call(endpoint, params)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
ALL_API_ENDPOINTS.keys.each do |method_name|
|
62
|
+
define_method method_name do |*args|
|
63
|
+
hash = args.first.is_a?(::Hash) ? args.first : {}
|
64
|
+
endpoint = ALL_API_ENDPOINTS[method_name]
|
65
|
+
params = {
|
66
|
+
'brandCode': hash[:brandCode],
|
67
|
+
'countryCode': hash[:countryCode],
|
68
|
+
'cursor': hash[:cursor],
|
69
|
+
'fromDate': hash[:fromDate],
|
70
|
+
'limit': hash[:limit],
|
71
|
+
'status': hash[:status],
|
72
|
+
'toDate': hash[:toDate],
|
73
|
+
'type': hash[:type]
|
51
74
|
}.compact
|
52
75
|
return perform_api_call(endpoint, params)
|
53
76
|
end
|
data/lib/realogy/version.rb
CHANGED
data/lib/realogy.rb
CHANGED
@@ -2,6 +2,7 @@ require "realogy/version"
|
|
2
2
|
require "realogy/railtie" if defined?(Rails)
|
3
3
|
require "realogy/app/models/application_record.rb"
|
4
4
|
require "realogy/app/models/data_sync.rb"
|
5
|
+
require "realogy/app/models/date_time.rb"
|
5
6
|
require "realogy/app/models/hash.rb"
|
6
7
|
require "realogy/app/models/realogy/entity.rb"
|
7
8
|
require "realogy/app/models/realogy/agent.rb"
|
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.2
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/realogy/app/jobs/populate_realogy_entity_job.rb
|
121
121
|
- lib/realogy/app/models/application_record.rb
|
122
122
|
- lib/realogy/app/models/data_sync.rb
|
123
|
+
- lib/realogy/app/models/date_time.rb
|
123
124
|
- lib/realogy/app/models/hash.rb
|
124
125
|
- lib/realogy/app/models/realogy/agent.rb
|
125
126
|
- lib/realogy/app/models/realogy/company.rb
|