Sha256: 70c380f80bd5a61ec0cfe54a071cc75bdd94b7ebd925b60191eaf60f35c0d8d7

Contents?: true

Size: 936 Bytes

Versions: 6

Compression:

Stored size: 936 Bytes

Contents

require 'yardi/request_section'

module Yardi
  module RequestSection
    # Generate the data needed for a ProspectSearch
    class Prospect
      attr_reader :property_id, :prospect

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

      # Even though we may not send data for some fields, Yardi needs empty
      # nodes or the request fails.
      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yardi-4.11.4 lib/yardi/request_section/prospect.rb
yardi-4.11.3 lib/yardi/request_section/prospect.rb
yardi-5.0.1 lib/yardi/request_section/prospect.rb
yardi-4.11.2 lib/yardi/request_section/prospect.rb
yardi-4.11.1 lib/yardi/request_section/prospect.rb
yardi-4.11.0 lib/yardi/request_section/prospect.rb