Class: Entrata::Request::SendGeneralLeads
- Inherits:
-
Base
- Object
- Base
- Entrata::Request::SendGeneralLeads
show all
- Defined in:
- lib/entrata/request/send_general_leads.rb
Overview
the general Entrata API that we have access to through the drive team. Used for adding leads through the general API that don’t go through the inactive/reactivate flow
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #perform, #perform_with_curl
Instance Method Details
#after_initialize(customer:, lead_source_id:, preferences:, property_id:) ⇒ Object
Preferences are optional for inserting a lead into Entrata.
9
10
11
12
13
14
|
# File 'lib/entrata/request/send_general_leads.rb', line 9
def after_initialize(customer:, lead_source_id:, preferences:, property_id:)
@customer = customer
@lead_source_id = lead_source_id
@preferences = preferences
@property_id = property_id
end
|
#body ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/entrata/request/send_general_leads.rb', line 28
def body
{
auth: resource_auth,
requestId: '15', method: {
name: resource_name,
params: resource_params
}
}.to_json
end
|
#resource_auth ⇒ Object
16
17
18
|
# File 'lib/entrata/request/send_general_leads.rb', line 16
def resource_auth
{ type: 'basic' }
end
|
#resource_name ⇒ Object
20
21
22
|
# File 'lib/entrata/request/send_general_leads.rb', line 20
def resource_name
'sendLeads'
end
|
#resource_params ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/entrata/request/send_general_leads.rb', line 39
def resource_params
five_minutes_ago = 5.minutes.ago.in_time_zone('America/Denver').strftime('%m/%d/%YT%H:%M:%S')
{
propertyId: property_id, doNotSendConfirmationEmail: '1', isWaitList: '0',
prospects: {
prospect: [
{
leadSource: {
originatingLeadSourceId: lead_source_id },
createdDate: five_minutes_ago, customers: { customer: [
{
name: {
firstName: customer.first_name,
lastName: customer.last_name
},
phone: {
cellPhoneNumber: customer.phone
},
email: customer.email
}
]
},
customerPreferences: {
desiredMoveInDate: formatted_move_in_date,
comment: preferences.,
desiredNumBedrooms: preferences.beds
}
}
]
}
}
end
|
#resource_path ⇒ Object
24
25
26
|
# File 'lib/entrata/request/send_general_leads.rb', line 24
def resource_path
'/api/leads'
end
|