Sha256: 54a7ec94694581409b7ef379b0289a1dbf265deea5f58f597817ef70336c206c

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Yardi
  module Utils
    class TestDataFetcher
      RESIDENTS_PATH = 'test-data/residents/'
      GUESTCARD_ACTIVITY_PATH = 'test-data/yardi_prospects/'
      def self.residents(property_id)
        GoogleCloudStorage.read_file(file_path: RESIDENTS_PATH + "#{property_id}.xml")
      end

      def self.guest_card_activity(property_id, prospect)
        search_by = case prospect
                    when -> (p) { p.yardi_prospect_id }
                      { '/prospect_id/' => prospect.yardi_prospect_id }
                    when -> (p) { p.email }
                      { '/email/' => prospect.email.gsub(/\./,'') }
                    when -> (p) { p.first_name } && -> (p) { p.last_name }
                      { '/name/' => prospect.first_name + ' ' + prospect.last_name }
                    when -> (p) { p.phone }
                      { '/phone/' => prospect.phone }
                    end 

        file_path = GUESTCARD_ACTIVITY_PATH + property_id.to_s + search_by.keys.first + search_by[search_by.keys.first] + '.xml'
        GoogleCloudStorage.read_file(file_path: file_path)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yardi-4.11.0 lib/yardi/utils/test_data_fetcher.rb