realogy 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39157bab5613f551a79942ecaa5a7a9de1efd27696f0e5b9eb015ed9025609d3
4
- data.tar.gz: c83aa9931e05ebdaf1f6d4e7e9837e55bbf8441ff06cadc78cbf2c15e614b56b
3
+ metadata.gz: 070c110f851e922a6ce85d09776cd71f8468d0e9b631d4f0f33f1259d85aeafa
4
+ data.tar.gz: fca16011f5496233d78d31b77f5028e02269d3cc1ac2240de9bec938e9be5d81
5
5
  SHA512:
6
- metadata.gz: acbf1c9e3e550a58358e43f4fd4bd9b189cd62cef6b7aca785c4a0acf518096a5415cb5f5de058df03d3de1e949784f54960ec7954a93b8da16695c455bc1941
7
- data.tar.gz: 2b4a50cd19736dc716e3e365d9b8f5b2e58b54674e830540e3a6da0da605259cb6069cfd55534cecf761f1dcfaa9dcdac14e28509a2ee9f04b27e009cf58e3ca
6
+ metadata.gz: f1727318a977c3d548f8d42b399dd42d01ab6eb52072952badc5ff106f3faf2aae2e3f0c7ef8a2de3c439693edc89a8474947c01718bf77677ec53f23466d681
7
+ data.tar.gz: cca7c4a7a13236f2d63df1966ab0f91123be145ce8458f52bd9b48af409f8c00086c12b81715dad466cfa152dec6450e144fd90d13ace13ecb29cf4ad07d58f4
data/README.md CHANGED
@@ -204,13 +204,18 @@ Convenience methods to access JSON.
204
204
  - areas_of_specialization
205
205
  - business_phone
206
206
  - business_phone_ext
207
+ - company_brand_code
208
+ - company_id
209
+ - company_name
207
210
  - default_photo_url
208
211
  - designations
209
212
  - display_title
210
213
  - email_address
211
214
  - first_name
212
215
  - gender
216
+ - has_producing_role?
213
217
  - is_agent?
218
+ - is_full_time?
214
219
  - is_team_member?
215
220
  - languages_spoken
216
221
  - last_name
@@ -223,6 +228,24 @@ Convenience methods to access JSON.
223
228
  - mobile_phone
224
229
  - name
225
230
  - office
231
+ - office_address
232
+ - office_city
233
+ - office_country
234
+ - office_country_code
235
+ - office_district
236
+ - office_email_address
237
+ - office_fax_number
238
+ - office_formatted_address
239
+ - office_id
240
+ - office_latitude
241
+ - office_longitude
242
+ - office_name
243
+ - office_phone_number
244
+ - office_postal_code
245
+ - office_state_province
246
+ - office_state_province_code
247
+ - office_street_address
248
+ - office_type
226
249
  - remarks
227
250
  - roles
228
251
  - specialty
@@ -0,0 +1,31 @@
1
+ Hash.class_eval do
2
+
3
+ def dig_for_array(*path)
4
+ (v = self.dig(*path)).is_a?(Array) ? v : nil
5
+ end
6
+
7
+ def dig_for_boolean(*path)
8
+ (v = self.dig(*path)).to_s.upcase.eql?("TRUE") ? true : nil
9
+ end
10
+
11
+ def dig_for_datetime(*path)
12
+ self.dig(*path).to_datetime rescue nil
13
+ end
14
+
15
+ def dig_for_decimal(*path)
16
+ (v = self.dig(*path).to_f) != 0.0 ? v : nil
17
+ end
18
+
19
+ def dig_for_hash(*path)
20
+ (v = self.dig(*path)).is_a?(Hash) ? v : nil
21
+ end
22
+
23
+ def dig_for_integer(*path)
24
+ (v = self.dig(*path).to_i) != 0 ? v : nil
25
+ end
26
+
27
+ def dig_for_string(*path)
28
+ (v = self.dig(*path)).to_s.present? ? (v.eql?("0") ? nil : v) : nil
29
+ end
30
+
31
+ end
@@ -55,6 +55,27 @@ class Realogy::Agent < Realogy::Entity
55
55
  self.dig_for_string("agentSummary", "businessPhoneExt")
56
56
  end
57
57
 
58
+ # office / brandCode : String
59
+ # The Franchise that the Office is part of
60
+
61
+ def company_brand_code
62
+ self.dig_for_string("agentSummary", "office", "brandCode")
63
+ end
64
+
65
+ # office / companyId : String
66
+ # description": "Globally unique identifier assigned to a company by Realogy
67
+
68
+ def company_id
69
+ self.dig_for_string("agentSummary", "office", "companyId")
70
+ end
71
+
72
+ # office / companyName : String
73
+ # Name of the Company
74
+
75
+ def company_name
76
+ self.dig_for_string("agentSummary", "office", "companyName")
77
+ end
78
+
58
79
  # defaultPhotoURL : String
59
80
  # Profile photo URL for the Agent
60
81
 
@@ -97,13 +118,27 @@ class Realogy::Agent < Realogy::Entity
97
118
  self.dig_for_string("agentSummary", "gender")
98
119
  end
99
120
 
121
+ # isProducingRole : Boolean
122
+ #
123
+ def has_producing_role?
124
+ return nil unless (arr = self.roles).is_a?(Array)
125
+ arr.map{|r| r.dig_for_boolean("isProducingRole")}.include?(true)
126
+ end
127
+
100
128
  # isAgent : Boolean
101
129
  # Indicates whether the person is an agent or not
102
130
 
103
131
  def is_agent?
104
132
  self.dig_for_boolean("agentSummary", "isAgent")
105
133
  end
106
-
134
+
135
+ # isFullTime : Boolean
136
+
137
+ def is_full_time?
138
+ return nil unless (arr = self.roles).is_a?(Array)
139
+ arr.map{|r| r.dig_for_boolean("isFullTime")}.include?(true)
140
+ end
141
+
107
142
  # isTeamMember : Boolean
108
143
  # Indicates whether the person is a team member or not
109
144
 
@@ -186,6 +221,131 @@ class Realogy::Agent < Realogy::Entity
186
221
  self.dig_for_string("agentSummary", "office")
187
222
  end
188
223
 
224
+ # office / officeAddress : Hash
225
+
226
+ def office_address
227
+ self.dig_for_hash("agentSummary", "office", "officeAddress")
228
+ end
229
+
230
+ # office / officeAddress / city : String
231
+ # City
232
+
233
+ def office_city
234
+ self.dig_for_string("agentSummary", "office", "officeAddress", "city")
235
+ end
236
+
237
+ # office / officeAddress / country : String
238
+ # Country
239
+
240
+ def office_country
241
+ self.dig_for_string("agentSummary", "office", "officeAddress", "country")
242
+ end
243
+
244
+ # office / officeAddress / countryCode : String
245
+ # ISO Code of the country
246
+
247
+ def office_country_code
248
+ self.dig_for_string("agentSummary", "office", "officeAddress", "countryCode")
249
+ end
250
+
251
+ # office / officeAddress / district : String
252
+ # Subdivision name in the country or region for the address. In USA it's same as County.
253
+
254
+ def office_district
255
+ self.dig_for_string("agentSummary", "office", "officeAddress", "district")
256
+ end
257
+
258
+ # office / emailAddress : String
259
+ # Main contact email address for the office
260
+
261
+ def office_email_address
262
+ self.dig_for_string("agentSummary", "office", "emailAddress")
263
+ end
264
+
265
+ # office / faxNumber : String
266
+ # Fax number for the office
267
+
268
+ def office_fax_number
269
+ self.dig_for_string("agentSummary", "office", "faxNumber")
270
+ end
271
+
272
+ # office / officeAddress / formattedAddress : String
273
+ # Formatted address for display purpose
274
+
275
+ def office_formatted_address
276
+ self.dig_for_string("agentSummary", "office", "officeAddress", "formattedAddress")
277
+ end
278
+
279
+ # office / officeId : String
280
+ # Globally unique identifier assigned to an office by Realogy
281
+
282
+ def office_id
283
+ self.dig_for_string("agentSummary", "office", "officeId")
284
+ end
285
+
286
+ # office / officeAddress / latitude : Decimal
287
+ # Latitude of a location
288
+
289
+ def office_latitude
290
+ self.dig_for_decimal("agentSummary", "office", "officeAddress", "latitude")
291
+ end
292
+
293
+ # office / officeAddress / longitude : Decimal
294
+ # Longitude of a location
295
+
296
+ def office_longitude
297
+ self.dig_for_decimal("agentSummary", "office", "officeAddress", "longitude")
298
+ end
299
+
300
+ # office / name : String
301
+ # Name of the office
302
+
303
+ def office_name
304
+ self.dig_for_string("agentSummary", "office", "name")
305
+ end
306
+
307
+ # office / officeAddress / phoneNumber : String
308
+ # Main contact phone number for the office
309
+
310
+ def office_phone_number
311
+ self.dig_for_string("agentSummary", "office", "officeAddress", "phoneNumber")
312
+ end
313
+
314
+ # office / officeAddress / postalCode : String
315
+ # ZIP/Postal code
316
+
317
+ def office_postal_code
318
+ self.dig_for_string("agentSummary", "office", "officeAddress", "postalCode")
319
+ end
320
+
321
+ # office / officeAddress / stateProvince : String
322
+ # State/Province where the address is
323
+
324
+ def office_state_province
325
+ self.dig_for_string("agentSummary", "office", "officeAddress", "stateProvince")
326
+ end
327
+
328
+ # office / officeAddress / stateProvinceCode : String
329
+ # ISO code of the state
330
+
331
+ def office_state_province_code
332
+ self.dig_for_string("agentSummary", "office", "officeAddress", "stateProvinceCode")
333
+ end
334
+
335
+ # office / officeAddress / streetAddress : String
336
+ # Street address
337
+
338
+ def office_street_address
339
+ self.dig_for_string("agentSummary", "office", "officeAddress", "streetAddress")
340
+ end
341
+
342
+ # office / type : String
343
+ # Type of office (Main, Branch, etc.)
344
+
345
+ def office_type
346
+ self.dig_for_string("agentSummary", "office", "type")
347
+ end
348
+
189
349
  # remarks : [Hash]
190
350
  # A collection of Profile descriptions associated with the Agent
191
351
 
@@ -1,3 +1,3 @@
1
1
  module Realogy
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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/hash.rb"
5
6
  require "realogy/app/models/realogy/entity.rb"
6
7
  require "realogy/app/models/realogy/agent.rb"
7
8
  require "realogy/app/models/realogy/company.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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-19 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,6 +119,7 @@ files:
119
119
  - lib/realogy/app/jobs/populate_realogy_entity_job.rb
120
120
  - lib/realogy/app/models/application_record.rb
121
121
  - lib/realogy/app/models/data_sync.rb
122
+ - lib/realogy/app/models/hash.rb
122
123
  - lib/realogy/app/models/realogy/agent.rb
123
124
  - lib/realogy/app/models/realogy/company.rb
124
125
  - lib/realogy/app/models/realogy/entity.rb