real_page 2.3.0 → 2.3.5

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: 99e5bb281ef2e8fe4277c5371035755bd0a1bbd5c78c13baf7acdce43552508d
4
- data.tar.gz: 5dbe91f96ad6e93a865c2024689fd9b81199911bbfec401406b4c53158a27473
3
+ metadata.gz: 8295c58abc8cb5cb8ad03bc4ce2eaa451f96dcac6ae0b477961d3dcd1b80c5a7
4
+ data.tar.gz: 5f7d93bc2b15bdaab91b6f000a5e751ad63c67b10a41257b226c9a41d72886aa
5
5
  SHA512:
6
- metadata.gz: 0214cedbcd52dce4e430971237f1aeab91cc90e92555d0359d43f09708dc6af56b277c91658d7c7b53975848f6d0933e5ab50a7d3b050e7a784f4929377f6c9e
7
- data.tar.gz: 967363593b823f3eed3e86770fc01b5d2b91158b3c2a27e27e61560d28b0ce1d3986520be2b6b3d88b6be46a1fb94d92799a3d36c13d503e8b5404a791ce0846
6
+ metadata.gz: b1dcbf414fe53a48900aab3b054ce74f5acf6674581f2ad2d0a3bbff328688f458b439c1f33f27040829ff7f2360e808be38281ea8d785ea1c0ba18df3e23d83
7
+ data.tar.gz: a8c3174d6676f26f9808d463f790e57784247e1edf13a4b48ab11833d947ea75f4a98789b86a8a62b349f2695f26bc865d9994b9bd06b8abaf82f2755602db6e
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,23 @@
1
+ Version 2.3.5, 2021-05-04
2
+ -------------------------
3
+ Add import_resident_id to prospect model
4
+
5
+ Version 2.3.4, 2021-04-23
6
+ -------------------------
7
+ Fix import_resident_id bug
8
+
9
+ Version 2.3.3, 2021-04-22
10
+ -------------------------
11
+ Add import_resident_id to lease model
12
+
13
+ Version 2.3.2, 2021-04-15
14
+ -------------------------
15
+ Fix date format
16
+
17
+ Version 2.3.1, 2021-04-13
18
+ -------------------------
19
+ Fix request_params_start_date/end_date data type and remote_prospect_id mapping
20
+
1
21
  Version 2.3.0, 2021-04-12
2
22
  -------------------------
3
23
  Add event_tracker and report PMS metrics
data/README.md CHANGED
@@ -201,6 +201,7 @@ The response from [GetLeasesByTrafficSource](#realpagerequestgetleasesbytraffics
201
201
  * `type` [String]
202
202
  * `unit_id` [String]
203
203
  * `unit_number` [String]
204
+ * `import_resident_id` [String]
204
205
 
205
206
  The allowed values of `leasetype` are set as constants in the `RealPage::Model::Lease::Type` module:
206
207
 
@@ -275,6 +276,8 @@ The main object representing a renter. It will be found on a
275
276
  * `site_id` [Integer]
276
277
  * `ssn_encrypted` [String]
277
278
  * `ssn` [String]
279
+ * `import_resident_id` [String]
280
+
278
281
 
279
282
  #### RealPage::Model::Quote
280
283
 
@@ -23,6 +23,7 @@ module RealPage
23
23
  type
24
24
  unit_id
25
25
  unit_number
26
+ import_resident_id
26
27
  ]
27
28
 
28
29
  # Possible values for leasetype, provided as a convenience
@@ -29,6 +29,7 @@ module RealPage
29
29
  relationship_id
30
30
  ssn
31
31
  ssn_encrypted
32
+ import_resident_id
32
33
  ]
33
34
  end
34
35
  end
@@ -10,7 +10,9 @@ module RealPage
10
10
 
11
11
  def self.track_pms_resident_event(
12
12
  remote_lease_id: nil,
13
+ import_resident_id:,
13
14
  resident_type:,
15
+ api_name:,
14
16
  request_params:,
15
17
  move_in_date: nil,
16
18
  lease_to: nil,
@@ -34,13 +36,13 @@ module RealPage
34
36
  service: RealPage.config.app_name
35
37
  ),
36
38
  remote_lease_id: remote_lease_id,
37
- import_resident_id: import_resident_id(request_params[:import_id]),
39
+ import_resident_id: import_resident_id,
38
40
  resident_type: resident_type,
39
- api_name: 'GetLeasesByTrafficSource',
41
+ api_name: api_name,
40
42
  request_params: EventTracker::ResourceFactory::PmsResident.build_request_params(
41
- start_date: request_params[:start_date],
42
- end_date: request_params[:end_date],
43
- prospect_id: request_params[:prospect_id],
43
+ start_date: (request_params[:start_date] || '').to_time,
44
+ end_date: (request_params[:end_date] || '').to_time,
45
+ prospect_id: request_params[:guest_card_id],
44
46
  pmc_id: request_params[:pmc_id],
45
47
  remote_id: request_params[:site_id],
46
48
  traffic_source_id: request_params[:traffic_source_id]
@@ -80,7 +82,7 @@ module RealPage
80
82
  service: RealPage.config.app_name
81
83
  ),
82
84
  remote_lease_id: remote_lease_id,
83
- import_resident_id: import_resident_id(request_params[:import_id]),
85
+ import_resident_id: request_params[:import_resident_id] || '',
84
86
  resident_type: resident_type,
85
87
  api_name: 'ProspectSearch',
86
88
  request_params: EventTracker::ResourceFactory::PmsProspect.build_request_params(
@@ -96,12 +98,6 @@ module RealPage
96
98
  )
97
99
  end
98
100
  end
99
-
100
- private
101
-
102
- def self.import_resident_id(import_id)
103
- "#{import_id}-#{SecureRandom.alphanumeric(15)}"
104
- end
105
101
  end
106
102
  end
107
103
  end
@@ -11,6 +11,7 @@ module RealPage
11
11
  def initialize(response, request_params, request_name)
12
12
  @response = response
13
13
  @request_params = request_params
14
+ @request_name = request_name
14
15
  end
15
16
 
16
17
  def validate!
@@ -20,17 +21,20 @@ module RealPage
20
21
 
21
22
  private
22
23
 
23
- attr_reader :response, :request_params
24
+ attr_reader :response, :request_params, :request_name
24
25
 
25
26
  def send_successful_response_data_to_snowflake
26
27
  leases.each do |lease|
28
+ lease['importresidentid'] = import_resident_id
27
29
  Utils::SnowflakeEventTracker.track_pms_resident_event(
28
30
  remote_lease_id: lease['leaseid'],
31
+ import_resident_id: lease['importresidentid'],
29
32
  resident_type: 'PRIMARY',
33
+ api_name: request_name,
30
34
  request_params: request_params,
31
- move_in_date: DateTime.strptime(lease['moveindate'], '%m/%d/%y').to_time,
32
- lease_to: DateTime.strptime(lease['leaseenddate'], '%m/%d/%y').to_time,
33
- lease_from: DateTime.strptime(lease['leasebegindate'], '%m/%d/%y').to_time,
35
+ move_in_date: format_date(lease['moveindate']),
36
+ lease_to: format_date(lease['leaseenddate']),
37
+ lease_from: format_date(lease['leasebegindate']),
34
38
  first_name_present: !lease['firstname'].blank?,
35
39
  last_name_present: !lease['lastname'].blank?,
36
40
  email_present: !lease['email'].blank?,
@@ -60,6 +64,18 @@ module RealPage
60
64
  end
61
65
  count
62
66
  end
67
+
68
+ def format_date(field)
69
+ return nil if field.blank?
70
+
71
+ # The date string from the response data is in the format of "6/1/2015 12:00:00 AM"
72
+ datetime_format = '%m/%d/%Y %I:%M:%S %p'
73
+ DateTime.strptime(field, datetime_format).to_time.utc
74
+ end
75
+
76
+ def import_resident_id
77
+ "#{request_params[:import_id]}-#{SecureRandom.alphanumeric(15)}"
78
+ end
63
79
  end
64
80
  end
65
81
  end
@@ -11,6 +11,7 @@ module RealPage
11
11
  def initialize(response, request_params, request_name)
12
12
  @response = response
13
13
  @request_params = request_params
14
+ @request_name = request_name
14
15
  @guest_cards = guest_cards
15
16
  end
16
17
 
@@ -21,7 +22,7 @@ module RealPage
21
22
 
22
23
  private
23
24
 
24
- attr_reader :response, :request_params, :guest_cards
25
+ attr_reader :response, :request_params, :request_name, :guest_cards
25
26
 
26
27
  def send_data_to_snowflake
27
28
  guest_cards.each do |guest_card|
@@ -33,8 +34,11 @@ module RealPage
33
34
 
34
35
  def send_roommates_data_to_snowflake(prospects)
35
36
  prospects.each do |prospect|
37
+ prospect['ImportResidentId'] = import_resident_id
36
38
  Utils::SnowflakeEventTracker.track_pms_resident_event(
39
+ import_resident_id: prospect['ImportResidentId'],
37
40
  resident_type: 'ROOMMATE',
41
+ api_name: request_name,
38
42
  request_params: request_params,
39
43
  first_name_present: !prospect['FirstName'].blank?,
40
44
  last_name_present: !prospect['LastName'].blank?,
@@ -47,11 +51,11 @@ module RealPage
47
51
  def send_prospects_data_to_snowflake(prospects, guest_card)
48
52
  prospects.each do |prospect|
49
53
  Utils::SnowflakeEventTracker.track_pms_prospect_event(
50
- resident_type: 'ROOMMATE',
54
+ resident_type: 'PRIMARY',
51
55
  request_params: request_params,
52
- contact_date: DateTime.parse(guest_card['DateContact']).to_time,
56
+ contact_date: format_date(guest_card['CreateDate']),
53
57
  contact_source: guest_card['PrimaryLeadSource'],
54
- remote_prospect_id: prospect['IdNumber']
58
+ remote_prospect_id: guest_card['GuestCardID']
55
59
  )
56
60
  end
57
61
  end
@@ -88,6 +92,15 @@ module RealPage
88
92
  end
89
93
  phone_numbers_hash.select { |phone_number| !phone_number['Number'].blank? }.length
90
94
  end
95
+
96
+ def format_date(field)
97
+ return nil if field.blank?
98
+ DateTime.parse(field).to_time
99
+ end
100
+
101
+ def import_resident_id
102
+ "#{request_params[:import_id]}-#{SecureRandom.alphanumeric(15)}"
103
+ end
91
104
  end
92
105
  end
93
106
  end
@@ -41,6 +41,7 @@ module RealPage
41
41
  def initialize(response, request_params, request_name)
42
42
  @response = response
43
43
  @request_params = request_params
44
+ @request_name = request_name
44
45
  end
45
46
 
46
47
  # @raise [RealPage::Error::RequestFault] if the response has an error
@@ -53,7 +54,7 @@ module RealPage
53
54
 
54
55
  private
55
56
 
56
- attr_reader :response, :request_params
57
+ attr_reader :response, :request_params, :request_name
57
58
 
58
59
  def contents
59
60
  body = response['s:Envelope']['s:Body']
@@ -82,6 +83,8 @@ module RealPage
82
83
 
83
84
  def send_request_error_to_snowflake
84
85
  Utils::SnowflakeEventTracker.track_pms_resident_event(
86
+ import_resident_id: request_params[:import_id] || '',
87
+ api_name: request_name,
85
88
  resident_type: 'PRIMARY',
86
89
  request_params: request_params,
87
90
  phones_count: 0,
@@ -64,6 +64,8 @@ module RealPage
64
64
 
65
65
  def send_move_in_report_error_to_snowflake
66
66
  Utils::SnowflakeEventTracker.track_pms_resident_event(
67
+ import_resident_id: request_params[:import_id] || '',
68
+ api_name: request_name,
67
69
  resident_type: 'PRIMARY',
68
70
  request_params: request_params,
69
71
  phones_count: 0,
@@ -78,6 +80,8 @@ module RealPage
78
80
 
79
81
  def send_roommate_error_to_snowflake
80
82
  Utils::SnowflakeEventTracker.track_pms_resident_event(
83
+ import_resident_id: request_params[:import_id] || '',
84
+ api_name: request_name,
81
85
  resident_type: 'ROOMMATE',
82
86
  request_params: request_params,
83
87
  phones_count: 0,
@@ -87,7 +91,7 @@ module RealPage
87
91
 
88
92
  def send_prospect_error_to_snowflake
89
93
  Utils::SnowflakeEventTracker.track_pms_prospect_event(
90
- resident_type: 'ROOMMATE',
94
+ resident_type: 'PRIMARY',
91
95
  request_params: request_params,
92
96
  error: error_message
93
97
  )
@@ -1,3 +1,3 @@
1
1
  module RealPage
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Collier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday