real_page 2.3.2 → 2.3.3

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: ec3c8dbb758a70f4acf1fbabfe1690840990574f16c3413a7a3b044dacaba7de
4
- data.tar.gz: 424461f45ad3491fef2a44308f2a8cd9fd1950d3d6ad22053cdc39d66d5c4da7
3
+ metadata.gz: 6f8ae44687f339a3dd101bcce2c4c8f30ea5145752ea3bebdda23f5db14d6bf7
4
+ data.tar.gz: 6e5c29901797d669f06167db00482890207903514682c87e7d3a1096048fedf3
5
5
  SHA512:
6
- metadata.gz: cc136e628d7e89d73ef978729b7b34f22895aee9abc8808460a00561bd70f5f24ec00b51bbc327e657ca57c63bb27faf7f9762851e5354c383f62f88eeb6b509
7
- data.tar.gz: e697684c9264cb3cb5c763438fe2d7e0c5fd588add956788a95d7b613b3c99c132781afd5aa562d93c17a14c2b2eaae7c6d1b9f62940b12eece63ca4bfb14293
6
+ metadata.gz: 05775dc19b32e58aabe5d0e723050f90d0ee3b5b3413829e6ef23659420b7198d8371ea0cf27590068f0ba0f6f6a9641155b6f27406a0bdc8dee08ee4253a5c8
7
+ data.tar.gz: 3ba8cc929da1e0273a0a1721c19d7f3d0064973b93fee6216d0cc82a3ec00544181c8569c082925da643f3dbb95842af7b3ab7f6df6fb3db5ffc9666644ff05a
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
1
+ Version 2.3.3, 2021-04-15
2
+ -------------------------
3
+ Add import_resident_id to lease model
4
+
1
5
  Version 2.3.2, 2021-04-15
2
6
  -------------------------
3
7
  Fix date format
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
 
@@ -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
@@ -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
43
  start_date: (request_params[:start_date] || '').to_time,
42
44
  end_date: (request_params[:end_date] || '').to_time,
43
- prospect_id: request_params[:prospect_id],
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,13 +21,16 @@ 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: import_resident_id,
29
32
  resident_type: 'PRIMARY',
33
+ api_name: request_name,
30
34
  request_params: request_params,
31
35
  move_in_date: format_date(lease['moveindate']),
32
36
  lease_to: format_date(lease['leaseenddate']),
@@ -68,6 +72,10 @@ module RealPage
68
72
  datetime_format = '%m/%d/%Y %I:%M:%S %p'
69
73
  DateTime.strptime(field, datetime_format).to_time.utc
70
74
  end
75
+
76
+ def import_resident_id
77
+ "#{request_params[:import_id]}-#{SecureRandom.alphanumeric(15)}"
78
+ end
71
79
  end
72
80
  end
73
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|
@@ -34,7 +35,9 @@ module RealPage
34
35
  def send_roommates_data_to_snowflake(prospects)
35
36
  prospects.each do |prospect|
36
37
  Utils::SnowflakeEventTracker.track_pms_resident_event(
38
+ import_resident_id: import_resident_id,
37
39
  resident_type: 'ROOMMATE',
40
+ api_name: request_name,
38
41
  request_params: request_params,
39
42
  first_name_present: !prospect['FirstName'].blank?,
40
43
  last_name_present: !prospect['LastName'].blank?,
@@ -47,9 +50,9 @@ module RealPage
47
50
  def send_prospects_data_to_snowflake(prospects, guest_card)
48
51
  prospects.each do |prospect|
49
52
  Utils::SnowflakeEventTracker.track_pms_prospect_event(
50
- resident_type: 'ROOMMATE',
53
+ resident_type: 'PRIMARY',
51
54
  request_params: request_params,
52
- contact_date: format_date(guest_card['DateContact']),
55
+ contact_date: format_date(guest_card['CreateDate']),
53
56
  contact_source: guest_card['PrimaryLeadSource'],
54
57
  remote_prospect_id: guest_card['GuestCardID']
55
58
  )
@@ -93,6 +96,10 @@ module RealPage
93
96
  return nil if field.blank?
94
97
  DateTime.parse(field).to_time
95
98
  end
99
+
100
+ def import_resident_id
101
+ "#{request_params[:import_id]}-#{SecureRandom.alphanumeric(15)}"
102
+ end
96
103
  end
97
104
  end
98
105
  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.2'
2
+ VERSION = '2.3.3'
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.2
4
+ version: 2.3.3
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-15 00:00:00.000000000 Z
11
+ date: 2021-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday