realogy 0.3.2 → 0.4.0

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: c57f98326c067508c84f5073c33bd538a44f94608c472a1d01c9fc79ffbca2ba
4
- data.tar.gz: 55981de8712110d8eb7fe6f4656ba7896543e67fe48c3d32ba428d145c35e754
3
+ metadata.gz: 39157bab5613f551a79942ecaa5a7a9de1efd27696f0e5b9eb015ed9025609d3
4
+ data.tar.gz: c83aa9931e05ebdaf1f6d4e7e9837e55bbf8441ff06cadc78cbf2c15e614b56b
5
5
  SHA512:
6
- metadata.gz: 60fe61f7b9013cf023bc22619cc94fbdf381ef1e06d26d0f8ab07255f6f7ba31ce762dd377bbcdce81f59197563e0f83bae7e80f3b36de324128e78f64b67408
7
- data.tar.gz: 73dce272f6726bfadd8eda74043ecdc09df97dbe72aee6b678deef54ea7cc3704277f05de4653cee5677074c5d2a8cdf15e383513523b436caf65e720ef36516
6
+ metadata.gz: acbf1c9e3e550a58358e43f4fd4bd9b189cd62cef6b7aca785c4a0acf518096a5415cb5f5de058df03d3de1e949784f54960ec7954a93b8da16695c455bc1941
7
+ data.tar.gz: 2b4a50cd19736dc716e3e365d9b8f5b2e58b54674e830540e3a6da0da605259cb6069cfd55534cecf761f1dcfaa9dcdac14e28509a2ee9f04b27e009cf58e3ca
data/README.md CHANGED
@@ -190,6 +190,266 @@ realogy.get_team_by_id(entity_id)
190
190
 
191
191
  ```
192
192
 
193
+ ## Instance methods
194
+
195
+ Convenience methods to access JSON.
196
+
197
+ #### Realogy::Agent
198
+
199
+ - addl_emails
200
+ - addl_languages_names
201
+ - addl_phones
202
+ - agent_summary
203
+ - agent_id
204
+ - areas_of_specialization
205
+ - business_phone
206
+ - business_phone_ext
207
+ - default_photo_url
208
+ - designations
209
+ - display_title
210
+ - email_address
211
+ - first_name
212
+ - gender
213
+ - is_agent?
214
+ - is_team_member?
215
+ - languages_spoken
216
+ - last_name
217
+ - last_update_on
218
+ - lead_email_address
219
+ - license_info
220
+ - media
221
+ - middle_name
222
+ - mls_information
223
+ - mobile_phone
224
+ - name
225
+ - office
226
+ - remarks
227
+ - roles
228
+ - specialty
229
+ - websites
230
+
231
+ #### Realogy::Company
232
+
233
+ - addl_language_names
234
+ - addl_websites
235
+ - brand_code
236
+ - can_do_commercial_business?
237
+ - commercial_company_name
238
+ - company_id
239
+ - company_summary
240
+ - is_nrt?
241
+ - last_update_on
242
+ - media
243
+ - name
244
+ - programs
245
+ - rfg_id
246
+ - website_url
247
+
248
+ #### Realogy::Listing
249
+
250
+ - active?
251
+ - agents
252
+ - agricultural_property_number
253
+ - anchor_stores
254
+ - annual_tax
255
+ - available_floors
256
+ - available_space
257
+ - average_floor_size
258
+ - average_occupancy_rate
259
+ - bay_depth
260
+ - building_area
261
+ - building_class
262
+ - by_appointment_only?
263
+ - call_to_show?
264
+ - cap_rate_percent
265
+ - cash_flow
266
+ - ceiling_height
267
+ - city
268
+ - clearance
269
+ - column_spacing
270
+ - common_area_factor
271
+ - country
272
+ - country_code
273
+ - default_photo_url
274
+ - development
275
+ - district
276
+ - dock_height
277
+ - down_payment
278
+ - floors
279
+ - formatted_address
280
+ - full_bath
281
+ - fully_leased_income
282
+ - geocode_confidence_level
283
+ - geographic_regions
284
+ - gross_income
285
+ - ground_level?
286
+ - half_bath
287
+ - has_cross_docks?
288
+ - has_rail_access?
289
+ - has_sprinkler?
290
+ - hide_list_price?
291
+ - is_for_auction?
292
+ - is_foreclosure?
293
+ - is_short_sale?
294
+ - last_sold_on
295
+ - last_update_on
296
+ - latitude
297
+ - lead_email
298
+ - lease_term
299
+ - lease_type
300
+ - levels
301
+ - linked_office
302
+ - list_price
303
+ - list_price_amount
304
+ - list_price_currency_code
305
+ - listed_on
306
+ - listing_id
307
+ - listing_type
308
+ - listing_url
309
+ - loan_payment
310
+ - longitude
311
+ - lot_dimension
312
+ - lot_size
313
+ - mapping_allowed?
314
+ - max_contiguous_area
315
+ - maximum_lease_rate
316
+ - media
317
+ - min_divisible_area
318
+ - minimum_lease_rate
319
+ - mls_information
320
+ - mls_numbers
321
+ - net_operating_income
322
+ - new_construction?
323
+ - no_of_bedrooms
324
+ - number_of_ballrooms
325
+ - number_of_conference_rooms
326
+ - number_of_docks
327
+ - occupancy_rate
328
+ - open_house
329
+ - parking_places
330
+ - parking_ratio
331
+ - partial_bath
332
+ - pending?
333
+ - photo_count
334
+ - postal_code
335
+ - power
336
+ - price_per_area
337
+ - price_upon_request?
338
+ - property_address
339
+ - property_category
340
+ - property_features
341
+ - property_fees
342
+ - property_floors
343
+ - property_name
344
+ - property_rooms
345
+ - property_style
346
+ - property_type
347
+ - property_use
348
+ - provider_category
349
+ - provider_key
350
+ - provider_name
351
+ - provider_url
352
+ - quarter_bath
353
+ - remarks
354
+ - rental_frequency
355
+ - rfg_listing_id
356
+ - schedule_income
357
+ - schools
358
+ - show_address_on_internet?
359
+ - square_footage
360
+ - state_province
361
+ - state_province_code
362
+ - street_address
363
+ - sub_lease?
364
+ - sub_units
365
+ - suite_apartment_name
366
+ - suites
367
+ - tax_id_number
368
+ - tax_information
369
+ - tax_roll_number
370
+ - tax_year
371
+ - team
372
+ - three_quarter_bath
373
+ - total_acres
374
+ - total_bath
375
+ - total_expenses
376
+ - total_rooms
377
+ - total_units
378
+ - turning_radius
379
+ - video_count
380
+ - websites
381
+ - year_built
382
+ - year_renovated
383
+ - zoning
384
+
385
+ #### Realogy::Office
386
+
387
+ - addl_language_names
388
+ - addl_phone_numbers
389
+ - addl_websites
390
+ - area_served
391
+ - brand_code
392
+ - broker_name
393
+ - city
394
+ - company_id
395
+ - company_name
396
+ - country
397
+ - country_code
398
+ - default_photo_url
399
+ - district
400
+ - email_address
401
+ - entity_preference
402
+ - fax_number
403
+ - formatted_address
404
+ - geographic_regions
405
+ - languages_spoken
406
+ - last_update_on
407
+ - latitude
408
+ - lead_email_address
409
+ - longitude
410
+ - media
411
+ - mls_information
412
+ - name
413
+ - office_address
414
+ - office_id
415
+ - office_manager_name
416
+ - office_summary
417
+ - office_type
418
+ - phone_number
419
+ - postal_code
420
+ - recruiting_email_address
421
+ - remarks
422
+ - rfg_company_id
423
+ - rfg_office_id
424
+ - seasonal_close_mmdd
425
+ - seasonal_open_mmdd
426
+ - special_markets
427
+ - state_province
428
+ - state_province_code
429
+ - street_address
430
+ - website_url
431
+
432
+ #### Realogy::Team
433
+
434
+ - awards
435
+ - addl_phone_numbers
436
+ - addl_emails
437
+ - addl_language_names
438
+ - addl_websites
439
+ - email_address
440
+ - last_update_on
441
+ - media
442
+ - members
443
+ - name
444
+ - office
445
+ - phone_number
446
+ - remarks
447
+ - rfg_team_id
448
+ - team_id
449
+ - team_type
450
+ - team_summary
451
+ - website_url
452
+
193
453
  ## Development
194
454
 
195
455
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,2 +1,217 @@
1
1
  class Realogy::Agent < Realogy::Entity
2
+
3
+ # addlEmails : [Hash]
4
+ # Additional emails of agent
5
+
6
+ def addl_emails
7
+ self.dig_for_array("addlEmails")
8
+ end
9
+
10
+ # addlLanguageNames : [Hash]
11
+ # Additional languages of agent
12
+
13
+ def addl_languages_names
14
+ self.dig_for_array("addlLanguageNames")
15
+ end
16
+
17
+ # addlPhones : [Hash]
18
+ # Additional phone numbers for agent
19
+
20
+ def addl_phones
21
+ self.dig_for_array("addlPhones")
22
+ end
23
+
24
+ # agentSummary : Hash
25
+
26
+ def agent_summary
27
+ self.dig_for_hash("agentSummary")
28
+ end
29
+
30
+ # id : String
31
+ # Globally unique identifier assigned to an Agent by Realogy
32
+
33
+ def agent_id
34
+ self.dig_for_string("agentSummary", "id")
35
+ end
36
+
37
+ # areasOfSpecialization : [String]
38
+ # Area of specialization for the agent
39
+
40
+ def areas_of_specialization
41
+ self.dig_for_array("areasOfSpecialization")
42
+ end
43
+
44
+ # businessPhone : String
45
+ # Business phone number of agent
46
+
47
+ def business_phone
48
+ self.dig_for_string("agentSummary", "businessPhone")
49
+ end
50
+
51
+ # businessPhoneExt : String
52
+ # Business phone extension of agent
53
+
54
+ def business_phone_ext
55
+ self.dig_for_string("agentSummary", "businessPhoneExt")
56
+ end
57
+
58
+ # defaultPhotoURL : String
59
+ # Profile photo URL for the Agent
60
+
61
+ def default_photo_url
62
+ self.dig_for_string("agentSummary", "defaultPhotoURL")
63
+ end
64
+
65
+ # designations : String
66
+ # Designation of the agent
67
+
68
+ def designations
69
+ self.dig_for_string("designations")
70
+ end
71
+
72
+ # displayTitle : String
73
+ # Title of the agent
74
+
75
+ def display_title
76
+ self.dig_for_string("agentSummary", "displayTitle")
77
+ end
78
+
79
+ # emailAddress : String
80
+ # Email address of the agent
81
+
82
+ def email_address
83
+ self.dig_for_string("agentSummary", "emailAddress")
84
+ end
85
+
86
+ # firstName : String
87
+ # First name of the agent
88
+
89
+ def first_name
90
+ self.dig_for_string("agentSummary", "firstName")
91
+ end
92
+
93
+ # gender : String
94
+ # Gender of the agent (male/female)
95
+
96
+ def gender
97
+ self.dig_for_string("agentSummary", "gender")
98
+ end
99
+
100
+ # isAgent : Boolean
101
+ # Indicates whether the person is an agent or not
102
+
103
+ def is_agent?
104
+ self.dig_for_boolean("agentSummary", "isAgent")
105
+ end
106
+
107
+ # isTeamMember : Boolean
108
+ # Indicates whether the person is a team member or not
109
+
110
+ def is_team_member?
111
+ self.dig_for_boolean("isTeamMember")
112
+ end
113
+
114
+ # languagesSpoken : [Hash]
115
+ # The languages agent speaks
116
+
117
+ def languages_spoken
118
+ self.dig_for_array("languagesSpoken")
119
+ end
120
+
121
+ # lastName : String
122
+ # Last name of the agent
123
+
124
+ def last_name
125
+ self.dig_for_string("agentSummary", "lastName")
126
+ end
127
+
128
+ # lastUpdateOn : DateTime
129
+ # The date/time that the Agent record was last updated in the system (UTC)
130
+
131
+ def last_update_on
132
+ self.dig_for_datetime("lastUpdateOn")
133
+ end
134
+
135
+ # leadEmailAddress : String
136
+ # Email address to send leads to the agent
137
+
138
+ def lead_email_address
139
+ self.dig_for_string("agentSummary", "leadEmailAddress")
140
+ end
141
+
142
+ # licenseInfo : [Hash]
143
+ # A collection of licenses associated with the Agent
144
+
145
+ def license_info
146
+ self.dig_for_array("licenseInfo")
147
+ end
148
+
149
+ # media: [Hash]
150
+
151
+ def media
152
+ self.dig_for_array("media")
153
+ end
154
+
155
+ # middleName : String
156
+ # Middle name of the agent
157
+
158
+ def middle_name
159
+ self.dig_for_string("agentSummary", "middleName")
160
+ end
161
+
162
+ # mlsInformation : [String]
163
+ # MLS numbers associated with the Agent
164
+
165
+ def mls_information
166
+ self.dig_for_array("mlsInformation")
167
+ end
168
+
169
+ # mobilePhone : String
170
+ # Mobile phone number of agent
171
+
172
+ def mobile_phone
173
+ self.dig_for_string("agentSummary", "mobilePhone")
174
+ end
175
+
176
+ # name : String
177
+ # Display Name of the agent
178
+
179
+ def name
180
+ self.dig_for_string("agentSummary", "name")
181
+ end
182
+
183
+ # office : String
184
+
185
+ def office
186
+ self.dig_for_string("agentSummary", "office")
187
+ end
188
+
189
+ # remarks : [Hash]
190
+ # A collection of Profile descriptions associated with the Agent
191
+
192
+ def remarks
193
+ self.dig_for_array("remarks")
194
+ end
195
+
196
+ # roles : [Hash]
197
+ # Role details of the agent
198
+
199
+ def roles
200
+ self.dig_for_array("roles")
201
+ end
202
+
203
+ # specialty : String
204
+ # Specialty of the agent
205
+
206
+ def specialty
207
+ self.dig_for_string("agentSummary", "specialty")
208
+ end
209
+
210
+ # webSites : [Hash]
211
+ # A collection of websites associated with the Agent
212
+
213
+ def websites
214
+ self.dig_for_array("webSites")
215
+ end
216
+
2
217
  end
@@ -1,2 +1,98 @@
1
1
  class Realogy::Company < Realogy::Entity
2
+
3
+ # addlLanguageNames : [Hash]
4
+ # A collection of Company names in other languages (non-English)
5
+
6
+ def addl_language_names
7
+ self.dig_for_array("addlLanguageNames")
8
+ end
9
+
10
+ # addlWebSites : [Hash]
11
+ # A collection of websites associated with the Company
12
+
13
+ def addl_websites
14
+ self.dig_for_array("addlWebSites")
15
+ end
16
+
17
+ # brandCode : String
18
+ # The brand that the Company is associated with
19
+
20
+ def brand_code
21
+ self.dig_for_array("companySummary", "brandCode")
22
+ end
23
+
24
+ # canDoCommercialBusiness : Boolean
25
+ # Will be 'true' if this company can do commercial business
26
+
27
+ def can_do_commercial_business?
28
+ self.dig_for_boolean("companySummary", "canDoCommercialBusiness")
29
+ end
30
+
31
+ # commercialCompanyName : String
32
+ # commercialCompanyName of the company
33
+
34
+ def commercial_company_name
35
+ self.dig_for_string("companySummary", "commercialCompanyName")
36
+ end
37
+
38
+ # id : String
39
+ # Globally unique identifier assigned to a Company by Realogy
40
+
41
+ def company_id
42
+ self.dig_for_string("companySummary", "id")
43
+ end
44
+
45
+ # companySummary : Hash
46
+
47
+ def company_summary
48
+ self.dig_for_hash("companySummary")
49
+ end
50
+
51
+ # isNrt : Boolean
52
+ # This indicates whether it is Nrt Type or not
53
+
54
+ def is_nrt?
55
+ self.dig_for_boolean("companySummary", "isNrt")
56
+ end
57
+
58
+ # lastUpdateOn : DateTime
59
+ # The date/time that the Company record was last updated in the system (UTC)
60
+
61
+ def last_update_on
62
+ self.dig_for_datetime("companySummary", "lastUpdateOn")
63
+ end
64
+
65
+ # media : [Hash]
66
+
67
+ def media
68
+ self.dig_for_array("media")
69
+ end
70
+
71
+ # name : String
72
+ # Name of the Company
73
+
74
+ def name
75
+ self.dig_for_string("companySummary", "name")
76
+ end
77
+
78
+ # programs ; [Hash]
79
+
80
+ def programs
81
+ self.dig_for_array("programs")
82
+ end
83
+
84
+ # RFGID : String
85
+ # Business identifier assigned to a Company by Realogy
86
+
87
+ def rfg_id
88
+ self.dig_for_string("companySummary", "RFGID")
89
+ end
90
+
91
+ # websiteURL : String
92
+ # URL to the Company's website
93
+
94
+ def website_url
95
+ self.dig_for_string("companySummary", "websiteURL")
96
+ end
97
+
2
98
  end
@@ -22,4 +22,38 @@ class Realogy::Entity < ApplicationRecord
22
22
  self.save if self.changed?
23
23
  end
24
24
 
25
+ def dig_for_array(*path)
26
+ return nil unless (json = self.data).is_a?(Hash)
27
+ (v = json.dig(*path)).is_a?(Array) ? v : nil
28
+ end
29
+
30
+ def dig_for_boolean(*path)
31
+ return nil unless (json = self.data).is_a?(Hash)
32
+ (v = json.dig(*path)).to_s.upcase.eql?("TRUE") ? true : nil
33
+ end
34
+
35
+ def dig_for_datetime(*path)
36
+ self.data.dig(*path).to_datetime rescue nil
37
+ end
38
+
39
+ def dig_for_decimal(*path)
40
+ return nil unless (json = self.data).is_a?(Hash)
41
+ (v = json.dig(*path).to_f) != 0.0 ? v : nil
42
+ end
43
+
44
+ def dig_for_hash(*path)
45
+ return nil unless (json = self.data).is_a?(Hash)
46
+ (v = json.dig(*path)).is_a?(Hash) ? v : nil
47
+ end
48
+
49
+ def dig_for_integer(*path)
50
+ return nil unless (json = self.data).is_a?(Hash)
51
+ (v = json.dig(*path).to_i) != 0 ? v : nil
52
+ end
53
+
54
+ def dig_for_string(*path)
55
+ return nil unless (json = self.data).is_a?(Hash)
56
+ (v = json.dig(*path)).to_s.present? ? (v.eql?("0") ? nil : v) : nil
57
+ end
58
+
25
59
  end