entrata 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2316690e03ac91b2580dbaab63c56ac93afc70eaef268c787d206aba024a484f
4
- data.tar.gz: 574ed8030e63871b2cb1a59afd3e5ea25a57a995b790ba5a2a6c606aa3965db3
3
+ metadata.gz: e080b32ca40b4be9e72097820c3f1244d59e286c0f4e1776fe469c7ec7edae76
4
+ data.tar.gz: 07c3e01ea57af5ab97787371516a67dab5da29c0cbc91982eb53aee3bd277f2f
5
5
  SHA512:
6
- metadata.gz: 678ea4ce2d8dbf797263d707df80c21351f26085c6e690d5024a23a346c52a272695f049e23c3a74cf536ff96257156878c9ba019ee050d62046f42ace087fe2
7
- data.tar.gz: e92102c9060201f39c692dbac217f27b77b60d131ac5ff12d33b639453225d728fd02c6b1548bad0423b12a04be91820e495d5e4736bd76498ec1ddf4b4d7c64
6
+ metadata.gz: 00fc8ee9ee524713b4dffcf51d8b02f89a4ded1a4b3ccabb321dc5a5b0bc54f08fc6b9592a681be8f24febac39b153537d880f1c2079274188d7afb0076498f5
7
+ data.tar.gz: cf29a5c1611ecd67622c319c55fabc7b2b1bbfe720351f2c54e4a6279c2d166681d7dbbd451f3b9dfe1bcdcffc8d82bfaa22bdd1464a4f2c3a17f4d0295a7631
@@ -5,8 +5,9 @@ require 'entrata/request/get_client_info'
5
5
  require 'entrata/request/get_ils_properties_data'
6
6
  require 'entrata/request/get_property_info'
7
7
  require 'entrata/request/process_property_activation'
8
- require 'entrata/request/send_lead_details'
8
+ require 'entrata/request/send_general_leads'
9
9
  require 'entrata/request/send_inactive_leads'
10
+ require 'entrata/request/send_lead_details'
10
11
  require 'entrata/request/send_reactivate_leads'
11
12
 
12
13
  # Client to access all API resources through
@@ -79,6 +80,17 @@ module Entrata
79
80
  ).perform
80
81
  end
81
82
 
83
+ def send_general_leads(customer:, lead_source_id:, preferences:, property_id:)
84
+ byebug
85
+ Request::SendGeneralLeads.new(
86
+ conn: basic_auth_conn,
87
+ customer: customer,
88
+ lead_source_id: lead_source_id,
89
+ preferences: preferences,
90
+ property_id: property_id
91
+ ).perform
92
+ end
93
+
82
94
  def send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:)
83
95
  Request::SendReactivateLeads.new(
84
96
  conn: basic_auth_conn,
@@ -0,0 +1,89 @@
1
+ require 'entrata/request/base'
2
+
3
+ module Entrata
4
+ module Request
5
+ # the general Entrata API that we have access to through the drive team.
6
+ # Used for adding leads through the general API that don't go through the inactive/reactivate flow
7
+ class SendGeneralLeads < Base
8
+ # Preferences are optional for inserting a lead into Entrata.
9
+ def after_initialize(customer:, lead_source_id:, preferences:, property_id:)
10
+ @customer = customer
11
+ @lead_source_id = lead_source_id
12
+ @preferences = preferences
13
+ @property_id = property_id
14
+ end
15
+
16
+ def resource_auth
17
+ { type: 'basic' }
18
+ end
19
+
20
+ def resource_name
21
+ 'sendLeads'
22
+ end
23
+
24
+ def resource_path
25
+ '/api/leads'
26
+ end
27
+
28
+ def body
29
+ {
30
+ auth: resource_auth,
31
+ requestId: '15', # used in all requests for Lea(SA) product
32
+ method: {
33
+ name: resource_name,
34
+ params: resource_params
35
+ }
36
+ }.to_json
37
+ end
38
+
39
+ def resource_params
40
+ # all dates and times used in the API are assumed to be in Mountain Time (MST or MDT)
41
+ five_minutes_ago = 5.minutes.ago.in_time_zone('America/Denver').strftime('%m/%d/%YT%H:%M:%S')
42
+ {
43
+ propertyId: property_id, # Entrata remote property ID
44
+ doNotSendConfirmationEmail: '1', # Suppress email to renter - need to validate
45
+ isWaitList: '0',
46
+ prospects: {
47
+ prospect: [
48
+ {
49
+ leadSource: {
50
+ originatingLeadSourceId: lead_source_id # ApartmentList source ID to be acquired during onboarding
51
+ },
52
+ createdDate: five_minutes_ago, # Now - 5 minutes
53
+ customers: { # Renter details
54
+ customer: [
55
+ {
56
+ name: {
57
+ firstName: customer.first_name,
58
+ lastName: customer.last_name
59
+ },
60
+ phone: {
61
+ cellPhoneNumber: customer.phone
62
+ },
63
+ email: customer.email
64
+ }
65
+ ]
66
+ },
67
+ customerPreferences: {
68
+ desiredMoveInDate: formatted_move_in_date,
69
+ comment: preferences.comments,
70
+ desiredNumBedrooms: preferences.beds
71
+ }
72
+ }
73
+ ]
74
+ }
75
+ }
76
+ end
77
+
78
+ private
79
+
80
+ attr_reader :customer, :preferences, :property_id, :lead_source_id
81
+
82
+ # Entrata needs mm/dd/yyyy format for move in dates and will respond with
83
+ # an error if we send them a format they don't like.
84
+ def formatted_move_in_date
85
+ preferences.move_in_date.strftime('%m/%d/%Y')
86
+ end
87
+ end
88
+ end
89
+ end
@@ -61,7 +61,12 @@ module Entrata
61
61
 
62
62
  def send_inactive_leads(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:)
63
63
  raise_forced_failure! if property_id == 'fail'
64
- StaticFileFetcher.parsed_response_for('send_lead_details')
64
+ StaticFileFetcher.parsed_response_for('send_inactive_leads')
65
+ end
66
+
67
+ def send_general_leads(customer:, lead_source_id:, preferences:, property_id:)
68
+ raise_forced_failure! if property_id == 'fail'
69
+ StaticFileFetcher.parsed_response_for('send_general_leads')
65
70
  end
66
71
 
67
72
  def send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:)
@@ -1,3 +1,3 @@
1
1
  module Entrata
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entrata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Richard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -136,6 +136,7 @@ files:
136
136
  - lib/entrata/request/get_ils_properties_data.rb
137
137
  - lib/entrata/request/get_property_info.rb
138
138
  - lib/entrata/request/process_property_activation.rb
139
+ - lib/entrata/request/send_general_leads.rb
139
140
  - lib/entrata/request/send_inactive_leads.rb
140
141
  - lib/entrata/request/send_lead_details.rb
141
142
  - lib/entrata/request/send_reactivate_leads.rb