Class: Entrata::Request::SendLeadDetails

Inherits:
Base
  • Object
show all
Defined in:
lib/entrata/request/send_lead_details.rb

Overview

Send renter information to a property

Instance Method Summary collapse

Methods inherited from Base

#body, #initialize, #perform, #perform_with_curl, #resource_auth, #resource_path

Constructor Details

This class inherits a constructor from Entrata::Request::Base

Instance Method Details

#after_initialize(customer:, preferences:, property_id:) ⇒ Object

Preferences are optional for inserting a lead into Entrata.



8
9
10
11
12
# File 'lib/entrata/request/send_lead_details.rb', line 8

def after_initialize(customer:, preferences:, property_id:)
  @customer = customer
  @preferences = preferences
  @property_id = property_id
end

#resource_nameObject



14
15
16
# File 'lib/entrata/request/send_lead_details.rb', line 14

def resource_name
  'sendLeadDetails'
end

#resource_paramsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/entrata/request/send_lead_details.rb', line 18

def resource_params
  {
    prospects: {
      prospect: [
        {
          propertyId: property_id,
          customer: {
            name: {
              firstName: customer.first_name,
              lastName: customer.last_name
            },
            email: customer.email,
            phone: customer.phone
          },
          customerPreferences: {
            targetMoveInDate: formatted_move_in_date,
            comments: preferences.comments,
            desiredNumBedrooms: preferences.beds,
            desiredNumBathrooms: preferences.baths,
            desiredRent: {
              min: preferences.min_price,
              max: preferences.max_price,
            },
            propertyUnitId: preferences.preferred_unit_id,
            propertyFloorplanId: preferences.preferred_floorplan_id,
            desiredLeaseTerms: preferences.lease_terms,
            pets: preferences.number_of_pets,
            occupants: ''
          }
        }
      ]
    }
  }
end