Class: Yardi::RequestSection::Prospect

Inherits:
Object
  • Object
show all
Defined in:
lib/yardi/request_section/prospect.rb

Overview

Generate the data needed for a ProspectSearch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(property_id:, prospect:) ⇒ Prospect

Returns a new instance of Prospect.



9
10
11
12
# File 'lib/yardi/request_section/prospect.rb', line 9

def initialize(property_id:, prospect:)
  @property_id = property_id
  @prospect = prospect
end

Instance Attribute Details

#property_idObject (readonly)

Returns the value of attribute property_id.



7
8
9
# File 'lib/yardi/request_section/prospect.rb', line 7

def property_id
  @property_id
end

#prospectObject (readonly)

Returns the value of attribute prospect.



7
8
9
# File 'lib/yardi/request_section/prospect.rb', line 7

def prospect
  @prospect
end

Instance Method Details

#generate(xml_builder) ⇒ Object

Even though we may not send data for some fields, Yardi needs empty nodes or the request fails.



16
17
18
19
20
21
22
23
24
25
# File 'lib/yardi/request_section/prospect.rb', line 16

def generate(xml_builder)
  xml_builder['itf'].YardiPropertyId property_id
  xml_builder['itf'].FirstName prospect.first_name
  xml_builder['itf'].LastName prospect.last_name
  xml_builder['itf'].EmailAddress prospect.email
  xml_builder['itf'].PhoneNumber prospect.phone
  prospect.phones&.each { |phone| xml_builder['itf'].PhoneNumber phone }
  xml_builder['itf'].ThirdPartyId prospect.yardi_prospect_id
  xml_builder['itf'].FederalId
end